diff --git a/.editorconfig b/.editorconfig
index f274d881..d1c0c72f 100644
--- a/.editorconfig
+++ b/.editorconfig
@@ -6,270 +6,10 @@ charset = utf-8
indent_style = tab
insert_final_newline = true
-# Csproj files
-[*.csproj]
+[*.{csproj,yml}]
indent_style = space
indent_size = 2
-# Code files for C#
[*.cs]
-indent_size = 4
-trim_trailing_whitespace = true
-
-# Organize usings
-dotnet_sort_system_directives_first = false
-
-# this. preferences
-dotnet_style_qualification_for_field = false : suggestion
-dotnet_style_qualification_for_event = false : suggestion
-dotnet_style_qualification_for_method = false : suggestion
-dotnet_style_qualification_for_property = false : suggestion
-
-# Language keywords vs BCL types preferences
-dotnet_style_predefined_type_for_locals_parameters_members = true : silent
-dotnet_style_predefined_type_for_member_access = true : silent
-
-# Parentheses preferences
-dotnet_style_parentheses_in_arithmetic_binary_operators = never_if_unnecessary : suggestion
-dotnet_style_parentheses_in_other_binary_operators = never_if_unnecessary : suggestion
-dotnet_style_parentheses_in_other_operators = never_if_unnecessary : suggestion
-dotnet_style_parentheses_in_relational_binary_operators = never_if_unnecessary : suggestion
-
-# Modifier preferences
-dotnet_style_readonly_field = true : warning
-dotnet_style_require_accessibility_modifiers = for_non_interface_members : suggestion
-
-# Expression-level preferences
-dotnet_style_coalesce_expression = true : suggestion
-dotnet_style_collection_initializer = true : warning
-dotnet_style_explicit_tuple_names = true : warning
-dotnet_style_null_propagation = true : suggestion
-dotnet_style_object_initializer = true : warning
-dotnet_style_prefer_auto_properties = true : silent
-dotnet_style_prefer_conditional_expression_over_assignment = true : silent
-dotnet_style_prefer_conditional_expression_over_return = true : silent
-dotnet_style_prefer_inferred_anonymous_type_member_names = true : suggestion
-dotnet_style_prefer_inferred_tuple_names = true : suggestion
-dotnet_style_prefer_is_null_check_over_reference_equality_method = true : silent
-
-# Style definitions
-dotnet_naming_style.instance_field_style.capitalization = camel_case
-dotnet_naming_style.pascal_case_style.capitalization = pascal_case
-
-# Use PascalCase with I prefix for interfaces
-dotnet_naming_symbols.interface_type_symbol.applicable_kinds = interface
-dotnet_naming_style.interface_type_style.capitalization = pascal_case
-dotnet_naming_style.interface_type_style.required_prefix = I
-dotnet_naming_rule.interface_types_must_be_prefixed_with_I.severity = warning
-dotnet_naming_rule.interface_types_must_be_prefixed_with_I.symbols = interface_type_symbol
-dotnet_naming_rule.interface_types_must_be_prefixed_with_I.style = interface_type_style
-
-# Use camelCase for parameters
-dotnet_naming_symbols.parameter_symbol.applicable_kinds = parameter
-dotnet_naming_style.parameter_style.capitalization = camel_case
-dotnet_naming_rule.parameters_are_camel_case.severity = warning
-dotnet_naming_rule.parameters_are_camel_case.symbols = parameter_symbol
-dotnet_naming_rule.parameters_are_camel_case.style = parameter_style
-
-# Use PascalCase for methods
-dotnet_naming_symbols.method_symbol.applicable_kinds = method
-dotnet_naming_style.method_style.capitalization = pascal_case
-dotnet_naming_rule.methods_are_pascal_case.severity = warning
-dotnet_naming_rule.methods_are_pascal_case.symbols = method_symbol
-dotnet_naming_rule.methods_are_pascal_case.style = method_style
-
-# Use PascalCase for constant fields with an accessibility of internal or higher
-dotnet_naming_rule.constant_fields_should_be_pascal_case.severity = warning
-dotnet_naming_rule.constant_fields_should_be_pascal_case.style = pascal_case_style
-dotnet_naming_rule.constant_fields_should_be_pascal_case.symbols = constant_fields
-dotnet_naming_symbols.constant_fields.applicable_accessibilities = public,protected_internal,internal
-dotnet_naming_symbols.constant_fields.applicable_kinds = field
-dotnet_naming_symbols.constant_fields.required_modifiers = const
-
-# Use PascalCase for static fields with an accessibility of internal or higher
-dotnet_naming_rule.static_fields_should_be_pascal_case.severity = warning
-dotnet_naming_rule.static_fields_should_be_pascal_case.style = pascal_case_style
-dotnet_naming_rule.static_fields_should_be_pascal_case.symbols = static_fields
-dotnet_naming_symbols.static_fields.applicable_accessibilities = public,protected_internal,internal
-dotnet_naming_symbols.static_fields.applicable_kinds = field
-dotnet_naming_symbols.static_fields.required_modifiers = static
-
-# Use camelCase with _ prefix for instance fields
-dotnet_naming_rule.instance_fields_should_be_camel_case.severity = warning
-dotnet_naming_rule.instance_fields_should_be_camel_case.style = instance_field_style
-dotnet_naming_rule.instance_fields_should_be_camel_case.symbols = instance_fields
-dotnet_naming_symbols.instance_fields.applicable_kinds = field
-dotnet_naming_rule.public_members_must_be_capitalized.severity = warning
-dotnet_naming_rule.public_members_must_be_capitalized.style = first_word_upper_case_style
-dotnet_naming_style.first_word_upper_case_style.capitalization = first_word_upper
-dotnet_naming_style.instance_field_style.required_prefix = _
-dotnet_naming_symbols.public_symbols.applicable_accessibilities = public
-dotnet_naming_symbols.public_symbols.applicable_kinds = property,method,field,event,delegate
-dotnet_naming_symbols.public_symbols.required_modifiers = readonly
-
-# Namespace preferences
-csharp_style_namespace_declarations = file_scoped : warning
-
-# var preferences
-csharp_style_var_elsewhere = false : warning
-csharp_style_var_for_built_in_types = false : warning
-csharp_style_var_when_type_is_apparent = false : warning
-
-# Expression-bodied members
-csharp_style_expression_bodied_accessors = true : silent
-csharp_style_expression_bodied_constructors = false : silent
-csharp_style_expression_bodied_indexers = true : silent
-csharp_style_expression_bodied_methods = false : silent
-csharp_style_expression_bodied_operators = false : silent
-csharp_style_expression_bodied_properties = true : silent
-
-# Pattern matching preferences
-csharp_style_pattern_matching_over_as_with_null_check = true : suggestion
-csharp_style_pattern_matching_over_is_with_cast_check = true : suggestion
-
-# Null-checking preferences
-csharp_style_conditional_delegate_call = true : suggestion
-csharp_style_throw_expression = true : suggestion
-
-# Modifier preferences
-csharp_preferred_modifier_order = public,private,protected,internal,static,extern,new,virtual,abstract,sealed,override,readonly,unsafe,volatile,async : suggestion
-
-# Expression-level preferences
-csharp_prefer_braces = true : silent
-csharp_prefer_simple_default_expression = true : suggestion
-csharp_style_deconstructed_variable_declaration = true : warning
-csharp_style_inlined_variable_declaration = true : suggestion
-csharp_style_pattern_local_over_anonymous_function = true : suggestion
-
-# New line preferences
-csharp_new_line_before_catch = true
-csharp_new_line_before_else = true
-csharp_new_line_before_finally = true
-csharp_new_line_before_members_in_anonymous_types = true
-csharp_new_line_before_members_in_object_initializers = true
-csharp_new_line_before_open_brace = all
-csharp_new_line_between_query_expression_clauses = true
-
-# Indentation preferences
-csharp_indent_case_contents = true
-csharp_indent_labels = flush_left
-csharp_indent_switch_labels = true
-
-# Space preferences
-csharp_space_after_cast = false
-csharp_space_after_colon_in_inheritance_clause = true
-csharp_space_after_keywords_in_control_flow_statements = true
-csharp_space_around_binary_operators = before_and_after
-csharp_space_before_colon_in_inheritance_clause = true
-csharp_space_between_method_call_empty_parameter_list_parentheses = false
-csharp_space_between_method_call_name_and_opening_parenthesis = false
-csharp_space_between_method_call_parameter_list_parentheses = false
-csharp_space_between_method_declaration_empty_parameter_list_parentheses = false
-csharp_space_between_method_declaration_parameter_list_parentheses = false
-csharp_space_between_parentheses = false
-
-# Wrapping preferences
-csharp_preserve_single_line_blocks = true
-csharp_preserve_single_line_statements = true
-
-# CSC warning suppressions when XML documentation is enabled
-
-# CS1591: Missing XML comment for publicly visible type or member.
-
-dotnet_diagnostic.CS1591.severity = none
-
-# StyleCopAnalyzers suppressions
-
-# SA0001: XML comment analysis is disabled due to project configuration.
-# SA1000: The keyword 'new' should be followed by a space. (C# 9)
-# SA1003: Operator should be preceded by whitespace. (C# 9)
-# SA1008: Opening parenthesis should be preceded by a space. (C# 9)
-# SA1027: Replace tabs with spaces.
-# SA1101: Prefix local calls with this.
-# SA1124: Do not use regions.
-# SA1200: Using directive should appear within a namespace declaration.
-# SA1202: Elements should be ordered by access.
-# SA1204: Static members should appear before non-static members.
-# SA1208: Using directive for 'System' should appear first.
-# SA1214: Readonly fields should appear before non-readonly fields.
-# SA1303: Const field names should begin with upper-case letter.
-# SA1309: Field should not begin with an underscore.
-# SA1311: Static readonly fields should begin with upper-case letter.
-# SA1407: Arithmetic expressions should declare precedence.
-# SA1408: Conditional expressions should declare precedence.
-# SA1503: Braces should not be omitted.
-# SA1516: Elements should be separated by blank line.
-# SA1600: Elements should be documented.
-# SA1601: Partial elements should be documented.
-# SA1602: Enumeration items should be documented.
-# SA1611: Element parameters value should be documented.
-# SA1615: Element return value should be documented.
-# SA1623: The property's documentation summary text should begin with: 'Gets'.
-# SA1633: The file header is missing or not located at the top of the file.
-# SA1642: Constructor summary documentation should begin with standard text.
-
-dotnet_diagnostic.SA0001.severity = none
-dotnet_diagnostic.SA1000.severity = none
-dotnet_diagnostic.SA1003.severity = none
-dotnet_diagnostic.SA1008.severity = none
-dotnet_diagnostic.SA1027.severity = none
-dotnet_diagnostic.SA1101.severity = none
-dotnet_diagnostic.SA1124.severity = none
-dotnet_diagnostic.SA1200.severity = none
-dotnet_diagnostic.SA1202.severity = none
-dotnet_diagnostic.SA1204.severity = none
-dotnet_diagnostic.SA1208.severity = none
-dotnet_diagnostic.SA1214.severity = none
-dotnet_diagnostic.SA1303.severity = none
-dotnet_diagnostic.SA1309.severity = none
-dotnet_diagnostic.SA1311.severity = none
-dotnet_diagnostic.SA1407.severity = none
-dotnet_diagnostic.SA1408.severity = none
-dotnet_diagnostic.SA1503.severity = none
-dotnet_diagnostic.SA1516.severity = none
-dotnet_diagnostic.SA1600.severity = none
-dotnet_diagnostic.SA1601.severity = none
-dotnet_diagnostic.SA1602.severity = none
-dotnet_diagnostic.SA1611.severity = none
-dotnet_diagnostic.SA1615.severity = none
-dotnet_diagnostic.SA1623.severity = none
-dotnet_diagnostic.SA1633.severity = none
-dotnet_diagnostic.SA1642.severity = none
-
-# StyleCopAnalyzers suppressions when using NRT
-
-# SA1009: Closing parenthesis should be followed by a space.
-# SA1011: Closing square bracket should be followed by a space.
-
-dotnet_diagnostic.SA1009.severity = none
-dotnet_diagnostic.SA1011.severity = none
-
-# SonarAnalyzers suppressions
-
-# S101: Rename class to match pascal case naming rules.
-# S112: 'System.Exception' should not be thrown by user code.
-# S1121: Extract the assignment from this expression. (C# 9)
-# S1135: Complete the task associated to this 'TODO' comment.
-# S1144: Unused private types or members should be removed. (C# 9)
-# S2368: Make this method private or simplify its parameters to not use multidimensional arrays.
-# S3358: Extract this nested ternary operation into an independent statement.
-# S3453: This class can't be instantiated; make its constructor 'public'. (C# 9)
-# S3903: Move class into a named namespace. (C# 10)
-
-dotnet_diagnostic.S101.severity = none
-dotnet_diagnostic.S112.severity = none
-dotnet_diagnostic.S1121.severity = none
-dotnet_diagnostic.S1135.severity = suggestion
-dotnet_diagnostic.S1144.severity = none
-dotnet_diagnostic.S2368.severity = none
-dotnet_diagnostic.S3358.severity = none
-dotnet_diagnostic.S3453.severity = none
-dotnet_diagnostic.S3903.severity = none
-
-# RoslynatorAnalyzers suppressions
-
-# RCS1090: Call 'ConfigureAwait(false)'.
-# RCS1123: Add parentheses when necessary.
-
-dotnet_diagnostic.RCS1090.severity = none
-dotnet_diagnostic.RCS1123.severity = none
+indent_size = 4
+trim_trailing_whitespace = true
diff --git a/.globalconfig b/.globalconfig
new file mode 100644
index 00000000..0013f73a
--- /dev/null
+++ b/.globalconfig
@@ -0,0 +1,320 @@
+is_global = true
+
+# Organize usings
+dotnet_sort_system_directives_first = false
+
+# this. preferences
+dotnet_style_qualification_for_field = false : suggestion
+dotnet_style_qualification_for_event = false : suggestion
+dotnet_style_qualification_for_method = false : suggestion
+dotnet_style_qualification_for_property = false : suggestion
+
+# Language keywords vs BCL types preferences
+dotnet_style_predefined_type_for_locals_parameters_members = true : silent
+dotnet_style_predefined_type_for_member_access = true : silent
+
+# Parentheses preferences
+dotnet_style_parentheses_in_arithmetic_binary_operators = never_if_unnecessary : suggestion
+dotnet_style_parentheses_in_other_binary_operators = never_if_unnecessary : suggestion
+dotnet_style_parentheses_in_other_operators = never_if_unnecessary : suggestion
+dotnet_style_parentheses_in_relational_binary_operators = never_if_unnecessary : suggestion
+
+# Modifier preferences
+dotnet_style_readonly_field = true : warning
+dotnet_style_require_accessibility_modifiers = for_non_interface_members : suggestion
+
+# Expression-level preferences
+dotnet_style_coalesce_expression = true : suggestion
+dotnet_style_collection_initializer = true : warning
+dotnet_style_explicit_tuple_names = true : warning
+dotnet_style_null_propagation = true : suggestion
+dotnet_style_object_initializer = true : warning
+dotnet_style_prefer_auto_properties = true : silent
+dotnet_style_prefer_conditional_expression_over_assignment = true : silent
+dotnet_style_prefer_conditional_expression_over_return = true : silent
+dotnet_style_prefer_inferred_anonymous_type_member_names = true : suggestion
+dotnet_style_prefer_inferred_tuple_names = true : suggestion
+dotnet_style_prefer_is_null_check_over_reference_equality_method = true : silent
+
+# Style definitions
+dotnet_naming_style.instance_field_style.capitalization = camel_case
+dotnet_naming_style.pascal_case_style.capitalization = pascal_case
+
+# Use PascalCase with I prefix for interfaces
+dotnet_naming_symbols.interface_type_symbol.applicable_kinds = interface
+dotnet_naming_style.interface_type_style.capitalization = pascal_case
+dotnet_naming_style.interface_type_style.required_prefix = I
+dotnet_naming_rule.interface_types_must_be_prefixed_with_I.severity = warning
+dotnet_naming_rule.interface_types_must_be_prefixed_with_I.symbols = interface_type_symbol
+dotnet_naming_rule.interface_types_must_be_prefixed_with_I.style = interface_type_style
+
+# Use camelCase for parameters
+dotnet_naming_symbols.parameter_symbol.applicable_kinds = parameter
+dotnet_naming_style.parameter_style.capitalization = camel_case
+dotnet_naming_rule.parameters_are_camel_case.severity = warning
+dotnet_naming_rule.parameters_are_camel_case.symbols = parameter_symbol
+dotnet_naming_rule.parameters_are_camel_case.style = parameter_style
+
+# Use PascalCase for methods
+dotnet_naming_symbols.method_symbol.applicable_kinds = method
+dotnet_naming_style.method_style.capitalization = pascal_case
+dotnet_naming_rule.methods_are_pascal_case.severity = warning
+dotnet_naming_rule.methods_are_pascal_case.symbols = method_symbol
+dotnet_naming_rule.methods_are_pascal_case.style = method_style
+
+# Use PascalCase for constant fields with an accessibility of internal or higher
+dotnet_naming_rule.constant_fields_should_be_pascal_case.severity = warning
+dotnet_naming_rule.constant_fields_should_be_pascal_case.style = pascal_case_style
+dotnet_naming_rule.constant_fields_should_be_pascal_case.symbols = constant_fields
+dotnet_naming_symbols.constant_fields.applicable_accessibilities = public,protected_internal,internal
+dotnet_naming_symbols.constant_fields.applicable_kinds = field
+dotnet_naming_symbols.constant_fields.required_modifiers = const
+
+# Use PascalCase for static fields with an accessibility of internal or higher
+dotnet_naming_rule.static_fields_should_be_pascal_case.severity = warning
+dotnet_naming_rule.static_fields_should_be_pascal_case.style = pascal_case_style
+dotnet_naming_rule.static_fields_should_be_pascal_case.symbols = static_fields
+dotnet_naming_symbols.static_fields.applicable_accessibilities = public,protected_internal,internal
+dotnet_naming_symbols.static_fields.applicable_kinds = field
+dotnet_naming_symbols.static_fields.required_modifiers = static
+
+# Use camelCase with _ prefix for instance fields
+dotnet_naming_rule.instance_fields_should_be_camel_case.severity = warning
+dotnet_naming_rule.instance_fields_should_be_camel_case.style = instance_field_style
+dotnet_naming_rule.instance_fields_should_be_camel_case.symbols = instance_fields
+dotnet_naming_symbols.instance_fields.applicable_kinds = field
+dotnet_naming_style.first_word_upper_case_style.capitalization = first_word_upper
+dotnet_naming_style.instance_field_style.required_prefix = _
+dotnet_naming_symbols.public_symbols.applicable_accessibilities = public
+dotnet_naming_symbols.public_symbols.applicable_kinds = property,method,field,event,delegate
+dotnet_naming_symbols.public_symbols.required_modifiers = readonly
+
+# Namespace preferences
+csharp_style_namespace_declarations = file_scoped : warning
+
+# var preferences
+csharp_style_var_elsewhere = false : warning
+csharp_style_var_for_built_in_types = false : warning
+csharp_style_var_when_type_is_apparent = false : warning
+
+# Expression-bodied members
+csharp_style_expression_bodied_accessors = true : silent
+csharp_style_expression_bodied_constructors = false : silent
+csharp_style_expression_bodied_indexers = true : silent
+csharp_style_expression_bodied_methods = false : silent
+csharp_style_expression_bodied_operators = false : silent
+csharp_style_expression_bodied_properties = true : silent
+
+# Pattern matching preferences
+csharp_style_pattern_matching_over_as_with_null_check = true : suggestion
+csharp_style_pattern_matching_over_is_with_cast_check = true : suggestion
+
+# Null-checking preferences
+csharp_style_conditional_delegate_call = true : suggestion
+csharp_style_throw_expression = true : suggestion
+
+# Modifier preferences
+csharp_preferred_modifier_order = public,private,protected,internal,static,extern,new,virtual,abstract,sealed,override,readonly,unsafe,volatile,async : suggestion
+
+# Expression-level preferences
+csharp_prefer_braces = true : silent
+csharp_prefer_simple_default_expression = true : suggestion
+csharp_style_deconstructed_variable_declaration = true : warning
+csharp_style_inlined_variable_declaration = true : suggestion
+csharp_style_pattern_local_over_anonymous_function = true : suggestion
+
+# New line preferences
+csharp_new_line_before_catch = true
+csharp_new_line_before_else = true
+csharp_new_line_before_finally = true
+csharp_new_line_before_members_in_anonymous_types = true
+csharp_new_line_before_members_in_object_initializers = true
+csharp_new_line_before_open_brace = all
+csharp_new_line_between_query_expression_clauses = true
+
+# Indentation preferences
+csharp_indent_case_contents = true
+csharp_indent_labels = flush_left
+csharp_indent_switch_labels = true
+
+# Space preferences
+csharp_space_after_cast = false
+csharp_space_after_colon_in_inheritance_clause = true
+csharp_space_after_keywords_in_control_flow_statements = true
+csharp_space_around_binary_operators = before_and_after
+csharp_space_before_colon_in_inheritance_clause = true
+csharp_space_between_method_call_empty_parameter_list_parentheses = false
+csharp_space_between_method_call_name_and_opening_parenthesis = false
+csharp_space_between_method_call_parameter_list_parentheses = false
+csharp_space_between_method_declaration_empty_parameter_list_parentheses = false
+csharp_space_between_method_declaration_parameter_list_parentheses = false
+csharp_space_between_parentheses = false
+
+# Wrapping preferences
+csharp_preserve_single_line_blocks = true
+csharp_preserve_single_line_statements = true
+
+# Severity: error
+
+# Because this call is not awaited, execution of the current method continues before the call is completed. Consider applying the 'await' operator to the result of the call.
+dotnet_diagnostic.CS4014.severity = error
+
+# Members attributed with RequiresUnreferencedCode may break when trimming.
+dotnet_diagnostic.IL2026.severity = error
+
+# Null-forgiving operator without justification
+dotnet_diagnostic.NX0001.severity = error
+
+# Null-forgiving operator without justification
+dotnet_diagnostic.NX0003.severity = error
+
+# Found markup element with unexpected name. If this is intended to be a component, add a @using directive for its namespace.
+dotnet_diagnostic.RZ10012.severity = error
+
+# Add a way to break out of this method/property's recursion.
+dotnet_diagnostic.S2190.severity = error
+
+# Severity: suggestion
+
+# Member is obsolete.
+dotnet_diagnostic.CS0618.severity = suggestion
+
+# Complete the task associated to this 'TODO' comment.
+dotnet_diagnostic.S1135.severity = suggestion
+
+# Severity: none
+
+# Validate arguments of public methods.
+dotnet_diagnostic.CA1062.severity = none
+
+# Do not directly await a Task.
+dotnet_diagnostic.CA2007.severity = none
+
+# Missing XML comment for publicly visible type or member.
+dotnet_diagnostic.CS1591.severity = none
+
+# Call 'ConfigureAwait(false)'.
+dotnet_diagnostic.RCS1090.severity = none
+
+# Add parentheses when necessary.
+dotnet_diagnostic.RCS1123.severity = none
+
+# The keyword 'new' should be followed by a space. (C# 9)
+dotnet_diagnostic.SA1000.severity = none
+
+# Operator should be preceded by whitespace. (C# 9)
+dotnet_diagnostic.SA1003.severity = none
+
+# Opening parenthesis should be preceded by a space. (C# 9)
+dotnet_diagnostic.SA1008.severity = none
+
+# Closing parenthesis should be followed by a space.
+dotnet_diagnostic.SA1009.severity = none
+
+# Closing square bracket should be followed by a space.
+dotnet_diagnostic.SA1011.severity = none
+
+# Replace tabs with spaces.
+dotnet_diagnostic.SA1027.severity = none
+
+# Prefix local calls with this.
+dotnet_diagnostic.SA1101.severity = none
+
+# Do not use regions.
+dotnet_diagnostic.SA1124.severity = none
+
+# Using directive should appear within a namespace declaration.
+dotnet_diagnostic.SA1200.severity = none
+
+# Elements should be ordered by access.
+dotnet_diagnostic.SA1202.severity = none
+
+# Static members should appear before non-static members.
+dotnet_diagnostic.SA1204.severity = none
+
+# The 'required' modifier should appear before 'public'. (C# 11)
+dotnet_diagnostic.SA1206.severity = none
+
+# Using directive for 'System' should appear first.
+dotnet_diagnostic.SA1208.severity = none
+
+# Readonly fields should appear before non-readonly fields.
+dotnet_diagnostic.SA1214.severity = none
+
+# Const field names should begin with upper-case letter.
+dotnet_diagnostic.SA1303.severity = none
+
+# Field should not begin with an underscore.
+dotnet_diagnostic.SA1309.severity = none
+
+# Field should not contain an underscore.
+dotnet_diagnostic.SA1310.severity = none
+
+# Static readonly fields should begin with upper-case letter.
+dotnet_diagnostic.SA1311.severity = none
+
+# Arithmetic expressions should declare precedence.
+dotnet_diagnostic.SA1407.severity = none
+
+# Conditional expressions should declare precedence.
+dotnet_diagnostic.SA1408.severity = none
+
+# Braces should not be omitted.
+dotnet_diagnostic.SA1503.severity = none
+
+# Elements should be separated by blank line.
+dotnet_diagnostic.SA1516.severity = none
+
+# Elements should be documented.
+dotnet_diagnostic.SA1600.severity = none
+
+# Partial elements should be documented.
+dotnet_diagnostic.SA1601.severity = none
+
+# Enumeration items should be documented.
+dotnet_diagnostic.SA1602.severity = none
+
+# Element parameters value should be documented.
+dotnet_diagnostic.SA1611.severity = none
+
+# Element return value should be documented.
+dotnet_diagnostic.SA1615.severity = none
+
+# The property's documentation summary text should begin with: 'Gets'.
+dotnet_diagnostic.SA1623.severity = none
+
+# The file header is missing or not located at the top of the file.
+dotnet_diagnostic.SA1633.severity = none
+
+# Constructor summary documentation should begin with standard text.
+dotnet_diagnostic.SA1642.severity = none
+
+# Rename class to match pascal case naming rules.
+dotnet_diagnostic.S101.severity = none
+
+# 'System.Exception' should not be thrown by user code.
+dotnet_diagnostic.S112.severity = none
+
+# Extract the assignment from this expression. (C# 9)
+dotnet_diagnostic.S1121.severity = none
+
+# Unused private types or members should be removed. (C# 9)
+dotnet_diagnostic.S1144.severity = none
+
+# Make this method private or simplify its parameters to not use multidimensional arrays.
+dotnet_diagnostic.S2368.severity = none
+
+# Static fields should not be used in generic types (C# 11 static abstract members).
+dotnet_diagnostic.S2743.severity = none
+
+# Extract this nested ternary operation into an independent statement.
+dotnet_diagnostic.S3358.severity = none
+
+# This class can't be instantiated; make its constructor 'public'. (C# 9)
+dotnet_diagnostic.S3453.severity = none
+
+# Move class into a named namespace. (C# 10)
+dotnet_diagnostic.S3903.severity = none
+
+# Use 'Guid.NewGuid()' or 'Guid.Empty' or add arguments to this GUID instantiation.
+dotnet_diagnostic.S4581.severity = none
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 2ce4a40d..e0e87396 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,13 @@
# Changelog
+## [1.5.0.0] - 2024-01-17
+
+This is an API compatibility update. Older versions will soon stop working.
+
+- The application now uses the latest API endpoints so that it can continue to function.
+- The application no longer checks for updates.
+- The application no longer displays the changelog.
+
## [1.4.0.0] - 2022-05-01
- API updates to support multiple builds. Windows 7 now has a separate build. More builds for other operating systems will follow in the future (not soon).
diff --git a/DevilDaggersAssetEditor.Tests/DevilDaggersAssetEditor.Tests.csproj b/DevilDaggersAssetEditor.Tests/DevilDaggersAssetEditor.Tests.csproj
index 6028f61f..145a6dd9 100644
--- a/DevilDaggersAssetEditor.Tests/DevilDaggersAssetEditor.Tests.csproj
+++ b/DevilDaggersAssetEditor.Tests/DevilDaggersAssetEditor.Tests.csproj
@@ -5,18 +5,18 @@
false
-
+
all
runtime; build; native; contentfiles; analyzers; buildtransitive
-
-
-
-
+
+
+
+
all
runtime; build; native; contentfiles; analyzers; buildtransitive
-
+
all
runtime; build; native; contentfiles; analyzers; buildtransitive
diff --git a/DevilDaggersAssetEditor.Wpf/Clients/DevilDaggersInfoApiClient.cs b/DevilDaggersAssetEditor.Wpf/Clients/DevilDaggersInfoApiClient.cs
index fa2d314d..68822f6b 100644
--- a/DevilDaggersAssetEditor.Wpf/Clients/DevilDaggersInfoApiClient.cs
+++ b/DevilDaggersAssetEditor.Wpf/Clients/DevilDaggersInfoApiClient.cs
@@ -1,6 +1,6 @@
//----------------------
//
-// Generated using the NSwag toolchain v13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v13.0.0.0)) (http://NSwag.org)
+// Generated using the NSwag toolchain v14.0.1.0 (NJsonSchema v11.0.0.0 (Newtonsoft.Json v13.0.0.0)) (http://NSwag.org)
//
//----------------------
@@ -9,29 +9,31 @@
#pragma warning disable 108 // Disable "CS0108 '{derivedDto}.ToJson()' hides inherited member '{dtoBase}.ToJson()'. Use the new keyword if hiding was intended."
#pragma warning disable 114 // Disable "CS0114 '{derivedDto}.RaisePropertyChanged(String)' hides inherited member 'dtoBase.RaisePropertyChanged(String)'. To make the current member override that implementation, add the override keyword. Otherwise add the new keyword."
#pragma warning disable 472 // Disable "CS0472 The result of the expression is always 'false' since a value of type 'Int32' is never equal to 'null' of type 'Int32?'
+#pragma warning disable 612 // Disable "CS0612 '...' is obsolete"
#pragma warning disable 1573 // Disable "CS1573 Parameter '...' has no matching param tag in the XML comment for ...
#pragma warning disable 1591 // Disable "CS1591 Missing XML comment for publicly visible type or member ..."
#pragma warning disable 8073 // Disable "CS8073 The result of the expression is always 'false' since a value of type 'T' is never equal to 'null' of type 'T?'"
#pragma warning disable 3016 // Disable "CS3016 Arrays as attribute arguments is not CLS-compliant"
#pragma warning disable 8603 // Disable "CS8603 Possible null reference return"
+#pragma warning disable 8604 // Disable "CS8604 Possible null reference argument for parameter"
+#pragma warning disable 8625 // Disable "CS8625 Cannot convert null literal to non-nullable reference type"
namespace DevilDaggersAssetEditor.Wpf.Clients
{
using System = global::System;
- [System.CodeDom.Compiler.GeneratedCode("NSwag", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v13.0.0.0))")]
+ [System.CodeDom.Compiler.GeneratedCode("NSwag", "14.0.1.0 (NJsonSchema v11.0.0.0 (Newtonsoft.Json v13.0.0.0))")]
public partial class DevilDaggersInfoApiClient
{
private System.Net.Http.HttpClient _httpClient;
- private System.Lazy _settings;
+ private static System.Lazy _settings = new System.Lazy(CreateSerializerSettings, true);
public DevilDaggersInfoApiClient(System.Net.Http.HttpClient httpClient)
{
_httpClient = httpClient;
- _settings = new System.Lazy(CreateSerializerSettings);
}
- private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings()
+ private static Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings()
{
var settings = new Newtonsoft.Json.JsonSerializerSettings();
UpdateJsonSerializerSettings(settings);
@@ -40,7 +42,7 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings()
protected Newtonsoft.Json.JsonSerializerSettings JsonSerializerSettings { get { return _settings.Value; } }
- partial void UpdateJsonSerializerSettings(Newtonsoft.Json.JsonSerializerSettings settings);
+ static partial void UpdateJsonSerializerSettings(Newtonsoft.Json.JsonSerializerSettings settings);
partial void PrepareRequest(System.Net.Http.HttpClient client, System.Net.Http.HttpRequestMessage request, string url);
partial void PrepareRequest(System.Net.Http.HttpClient client, System.Net.Http.HttpRequestMessage request, System.Text.StringBuilder urlBuilder);
@@ -48,11 +50,9 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings()
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
/// A server side error occurred.
- public virtual async System.Threading.Tasks.Task>> Assets_GetAssetInfoForDdaeAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
+ [System.Obsolete]
+ public virtual async System.Threading.Tasks.Task>> Assets_GetAssetInfoObsoleteAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
{
- var urlBuilder_ = new System.Text.StringBuilder();
- urlBuilder_.Append("api/assets/ddae/info");
-
var client_ = _httpClient;
var disposeClient_ = false;
try
@@ -62,6 +62,11 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings()
request_.Method = new System.Net.Http.HttpMethod("GET");
request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json"));
+ var urlBuilder_ = new System.Text.StringBuilder();
+
+ // Operation Path: "api/assets/ddae/info"
+ urlBuilder_.Append("api/assets/ddae/info");
+
PrepareRequest(client_, request_, urlBuilder_);
var url_ = urlBuilder_.ToString();
@@ -73,7 +78,9 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings()
var disposeResponse_ = true;
try
{
- var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value);
+ var headers_ = new System.Collections.Generic.Dictionary>();
+ foreach (var item_ in response_.Headers)
+ headers_[item_.Key] = item_.Value;
if (response_.Content != null && response_.Content.Headers != null)
{
foreach (var item_ in response_.Content.Headers)
@@ -114,15 +121,8 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings()
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
/// A server side error occurred.
- public virtual async System.Threading.Tasks.Task CustomEntries_GetCustomEntryReplayBufferByIdAsync(int id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
+ public virtual async System.Threading.Tasks.Task>> Assets_GetAssetInfoAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
{
- if (id == null)
- throw new System.ArgumentNullException("id");
-
- var urlBuilder_ = new System.Text.StringBuilder();
- urlBuilder_.Append("api/custom-entries/{id}/replay-buffer");
- urlBuilder_.Replace("{id}", System.Uri.EscapeDataString(ConvertToString(id, System.Globalization.CultureInfo.InvariantCulture)));
-
var client_ = _httpClient;
var disposeClient_ = false;
try
@@ -130,7 +130,12 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings()
using (var request_ = new System.Net.Http.HttpRequestMessage())
{
request_.Method = new System.Net.Http.HttpMethod("GET");
- request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/octet-stream"));
+ request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json"));
+
+ var urlBuilder_ = new System.Text.StringBuilder();
+
+ // Operation Path: "api/ddae/assets/info"
+ urlBuilder_.Append("api/ddae/assets/info");
PrepareRequest(client_, request_, urlBuilder_);
@@ -143,7 +148,9 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings()
var disposeResponse_ = true;
try
{
- var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value);
+ var headers_ = new System.Collections.Generic.Dictionary>();
+ foreach (var item_ in response_.Headers)
+ headers_[item_.Key] = item_.Value;
if (response_.Content != null && response_.Content.Headers != null)
{
foreach (var item_ in response_.Content.Headers)
@@ -153,32 +160,14 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings()
ProcessResponse(client_, response_);
var status_ = (int)response_.StatusCode;
- if (status_ == 200 || status_ == 206)
- {
- var responseStream_ = response_.Content == null ? System.IO.Stream.Null : await response_.Content.ReadAsStreamAsync().ConfigureAwait(false);
- var fileResponse_ = new FileResponse(status_, headers_, responseStream_, null, response_);
- disposeClient_ = false; disposeResponse_ = false; // response and client are disposed by FileResponse
- return fileResponse_;
- }
- else
- if (status_ == 400)
- {
- var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false);
- if (objectResponse_.Object == null)
- {
- throw new DevilDaggersInfoApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null);
- }
- throw new DevilDaggersInfoApiException("A server side error occurred.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null);
- }
- else
- if (status_ == 404)
+ if (status_ == 200)
{
- var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false);
+ var objectResponse_ = await ReadObjectResponseAsync>>(response_, headers_, cancellationToken).ConfigureAwait(false);
if (objectResponse_.Object == null)
{
throw new DevilDaggersInfoApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null);
}
- throw new DevilDaggersInfoApiException("A server side error occurred.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null);
+ return objectResponse_.Object;
}
else
{
@@ -202,15 +191,8 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings()
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
/// A server side error occurred.
- public virtual async System.Threading.Tasks.Task CustomEntries_GetCustomEntryReplayByIdAsync(int id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
+ public virtual async System.Threading.Tasks.Task> Mods_GetModsAsync(string? authorFilter = null, string? nameFilter = null, bool? isHostedFilter = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
{
- if (id == null)
- throw new System.ArgumentNullException("id");
-
- var urlBuilder_ = new System.Text.StringBuilder();
- urlBuilder_.Append("api/custom-entries/{id}/replay");
- urlBuilder_.Replace("{id}", System.Uri.EscapeDataString(ConvertToString(id, System.Globalization.CultureInfo.InvariantCulture)));
-
var client_ = _httpClient;
var disposeClient_ = false;
try
@@ -218,7 +200,26 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings()
using (var request_ = new System.Net.Http.HttpRequestMessage())
{
request_.Method = new System.Net.Http.HttpMethod("GET");
- request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/octet-stream"));
+ request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json"));
+
+ var urlBuilder_ = new System.Text.StringBuilder();
+
+ // Operation Path: "api/ddae/mods"
+ urlBuilder_.Append("api/ddae/mods");
+ urlBuilder_.Append('?');
+ if (authorFilter != null)
+ {
+ urlBuilder_.Append(System.Uri.EscapeDataString("authorFilter")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(authorFilter, System.Globalization.CultureInfo.InvariantCulture))).Append('&');
+ }
+ if (nameFilter != null)
+ {
+ urlBuilder_.Append(System.Uri.EscapeDataString("nameFilter")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(nameFilter, System.Globalization.CultureInfo.InvariantCulture))).Append('&');
+ }
+ if (isHostedFilter != null)
+ {
+ urlBuilder_.Append(System.Uri.EscapeDataString("isHostedFilter")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(isHostedFilter, System.Globalization.CultureInfo.InvariantCulture))).Append('&');
+ }
+ urlBuilder_.Length--;
PrepareRequest(client_, request_, urlBuilder_);
@@ -231,7 +232,9 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings()
var disposeResponse_ = true;
try
{
- var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value);
+ var headers_ = new System.Collections.Generic.Dictionary>();
+ foreach (var item_ in response_.Headers)
+ headers_[item_.Key] = item_.Value;
if (response_.Content != null && response_.Content.Headers != null)
{
foreach (var item_ in response_.Content.Headers)
@@ -241,32 +244,14 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings()
ProcessResponse(client_, response_);
var status_ = (int)response_.StatusCode;
- if (status_ == 200 || status_ == 206)
- {
- var responseStream_ = response_.Content == null ? System.IO.Stream.Null : await response_.Content.ReadAsStreamAsync().ConfigureAwait(false);
- var fileResponse_ = new FileResponse(status_, headers_, responseStream_, null, response_);
- disposeClient_ = false; disposeResponse_ = false; // response and client are disposed by FileResponse
- return fileResponse_;
- }
- else
- if (status_ == 400)
- {
- var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false);
- if (objectResponse_.Object == null)
- {
- throw new DevilDaggersInfoApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null);
- }
- throw new DevilDaggersInfoApiException("A server side error occurred.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null);
- }
- else
- if (status_ == 404)
+ if (status_ == 200)
{
- var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false);
+ var objectResponse_ = await ReadObjectResponseAsync>(response_, headers_, cancellationToken).ConfigureAwait(false);
if (objectResponse_.Object == null)
{
throw new DevilDaggersInfoApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null);
}
- throw new DevilDaggersInfoApiException("A server side error occurred.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null);
+ return objectResponse_.Object;
}
else
{
@@ -290,15 +275,9 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings()
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
/// A server side error occurred.
- public virtual async System.Threading.Tasks.Task CustomEntries_GetCustomEntryDataByIdAsync(int id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
+ [System.Obsolete]
+ public virtual async System.Threading.Tasks.Task> Mods_GetModsObsoleteAsync(string? authorFilter = null, string? nameFilter = null, bool? isHostedFilter = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
{
- if (id == null)
- throw new System.ArgumentNullException("id");
-
- var urlBuilder_ = new System.Text.StringBuilder();
- urlBuilder_.Append("api/custom-entries/{id}/data");
- urlBuilder_.Replace("{id}", System.Uri.EscapeDataString(ConvertToString(id, System.Globalization.CultureInfo.InvariantCulture)));
-
var client_ = _httpClient;
var disposeClient_ = false;
try
@@ -308,6 +287,25 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings()
request_.Method = new System.Net.Http.HttpMethod("GET");
request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json"));
+ var urlBuilder_ = new System.Text.StringBuilder();
+
+ // Operation Path: "api/mods/ddae"
+ urlBuilder_.Append("api/mods/ddae");
+ urlBuilder_.Append('?');
+ if (authorFilter != null)
+ {
+ urlBuilder_.Append(System.Uri.EscapeDataString("authorFilter")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(authorFilter, System.Globalization.CultureInfo.InvariantCulture))).Append('&');
+ }
+ if (nameFilter != null)
+ {
+ urlBuilder_.Append(System.Uri.EscapeDataString("nameFilter")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(nameFilter, System.Globalization.CultureInfo.InvariantCulture))).Append('&');
+ }
+ if (isHostedFilter != null)
+ {
+ urlBuilder_.Append(System.Uri.EscapeDataString("isHostedFilter")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(isHostedFilter, System.Globalization.CultureInfo.InvariantCulture))).Append('&');
+ }
+ urlBuilder_.Length--;
+
PrepareRequest(client_, request_, urlBuilder_);
var url_ = urlBuilder_.ToString();
@@ -319,7 +317,9 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings()
var disposeResponse_ = true;
try
{
- var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value);
+ var headers_ = new System.Collections.Generic.Dictionary>();
+ foreach (var item_ in response_.Headers)
+ headers_[item_.Key] = item_.Value;
if (response_.Content != null && response_.Content.Headers != null)
{
foreach (var item_ in response_.Content.Headers)
@@ -331,7 +331,7 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings()
var status_ = (int)response_.StatusCode;
if (status_ == 200)
{
- var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false);
+ var objectResponse_ = await ReadObjectResponseAsync>(response_, headers_, cancellationToken).ConfigureAwait(false);
if (objectResponse_.Object == null)
{
throw new DevilDaggersInfoApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null);
@@ -339,16 +339,6 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings()
return objectResponse_.Object;
}
else
- if (status_ == 404)
- {
- var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false);
- if (objectResponse_.Object == null)
- {
- throw new DevilDaggersInfoApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null);
- }
- throw new DevilDaggersInfoApiException("A server side error occurred.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null);
- }
- else
{
var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false);
throw new DevilDaggersInfoApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null);
@@ -370,13 +360,10 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings()
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
/// A server side error occurred.
- public virtual async System.Threading.Tasks.Task CustomEntries_SubmitScoreForDdclAsync(AddUploadRequest uploadRequest, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
+ public virtual async System.Threading.Tasks.Task Mods_GetModFileAsync(string modName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
{
- if (uploadRequest == null)
- throw new System.ArgumentNullException("uploadRequest");
-
- var urlBuilder_ = new System.Text.StringBuilder();
- urlBuilder_.Append("api/custom-entries/submit");
+ if (modName == null)
+ throw new System.ArgumentNullException("modName");
var client_ = _httpClient;
var disposeClient_ = false;
@@ -384,11 +371,15 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings()
{
using (var request_ = new System.Net.Http.HttpRequestMessage())
{
- var content_ = new System.Net.Http.StringContent(Newtonsoft.Json.JsonConvert.SerializeObject(uploadRequest, _settings.Value));
- content_.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json");
- request_.Content = content_;
- request_.Method = new System.Net.Http.HttpMethod("POST");
- request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json"));
+ request_.Method = new System.Net.Http.HttpMethod("GET");
+ request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/octet-stream"));
+
+ var urlBuilder_ = new System.Text.StringBuilder();
+
+ // Operation Path: "api/ddae/mods/{modName}/file"
+ urlBuilder_.Append("api/ddae/mods/");
+ urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(modName, System.Globalization.CultureInfo.InvariantCulture)));
+ urlBuilder_.Append("/file");
PrepareRequest(client_, request_, urlBuilder_);
@@ -401,7 +392,9 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings()
var disposeResponse_ = true;
try
{
- var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value);
+ var headers_ = new System.Collections.Generic.Dictionary>();
+ foreach (var item_ in response_.Headers)
+ headers_[item_.Key] = item_.Value;
if (response_.Content != null && response_.Content.Headers != null)
{
foreach (var item_ in response_.Content.Headers)
@@ -411,17 +404,25 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings()
ProcessResponse(client_, response_);
var status_ = (int)response_.StatusCode;
- if (status_ == 200)
+ if (status_ == 200 || status_ == 206)
+ {
+ var responseStream_ = response_.Content == null ? System.IO.Stream.Null : await response_.Content.ReadAsStreamAsync().ConfigureAwait(false);
+ var fileResponse_ = new FileResponse(status_, headers_, responseStream_, null, response_);
+ disposeClient_ = false; disposeResponse_ = false; // response and client are disposed by FileResponse
+ return fileResponse_;
+ }
+ else
+ if (status_ == 400)
{
- var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false);
+ var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false);
if (objectResponse_.Object == null)
{
throw new DevilDaggersInfoApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null);
}
- return objectResponse_.Object;
+ throw new DevilDaggersInfoApiException("A server side error occurred.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null);
}
else
- if (status_ == 400)
+ if (status_ == 404)
{
var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false);
if (objectResponse_.Object == null)
@@ -450,7042 +451,263 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings()
}
}
- /// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
- /// A server side error occurred.
- public virtual async System.Threading.Tasks.Task CustomLeaderboards_CustomLeaderboardExistsBySpawnsetHashAsync(byte[]? hash = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
+ protected struct ObjectResponseResult
{
- var urlBuilder_ = new System.Text.StringBuilder();
- urlBuilder_.Append("api/custom-leaderboards?");
- if (hash != null)
+ public ObjectResponseResult(T responseObject, string responseText)
{
- urlBuilder_.Append(System.Uri.EscapeDataString("hash") + "=").Append(System.Uri.EscapeDataString(ConvertToString(hash, System.Globalization.CultureInfo.InvariantCulture))).Append("&");
+ this.Object = responseObject;
+ this.Text = responseText;
}
- urlBuilder_.Length--;
-
- var client_ = _httpClient;
- var disposeClient_ = false;
- try
- {
- using (var request_ = new System.Net.Http.HttpRequestMessage())
- {
- request_.Method = new System.Net.Http.HttpMethod("HEAD");
- PrepareRequest(client_, request_, urlBuilder_);
-
- var url_ = urlBuilder_.ToString();
- request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute);
+ public T Object { get; }
- PrepareRequest(client_, request_, url_);
+ public string Text { get; }
+ }
- var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false);
- var disposeResponse_ = true;
- try
- {
- var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value);
- if (response_.Content != null && response_.Content.Headers != null)
- {
- foreach (var item_ in response_.Content.Headers)
- headers_[item_.Key] = item_.Value;
- }
+ public bool ReadResponseAsString { get; set; }
- ProcessResponse(client_, response_);
+ protected virtual async System.Threading.Tasks.Task> ReadObjectResponseAsync(System.Net.Http.HttpResponseMessage response, System.Collections.Generic.IReadOnlyDictionary> headers, System.Threading.CancellationToken cancellationToken)
+ {
+ if (response == null || response.Content == null)
+ {
+ return new ObjectResponseResult(default(T)!, string.Empty);
+ }
- var status_ = (int)response_.StatusCode;
- if (status_ == 200)
- {
- return;
- }
- else
- if (status_ == 404)
- {
- var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false);
- if (objectResponse_.Object == null)
- {
- throw new DevilDaggersInfoApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null);
- }
- throw new DevilDaggersInfoApiException("A server side error occurred.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null);
- }
- else
- {
- var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false);
- throw new DevilDaggersInfoApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null);
- }
- }
- finally
- {
- if (disposeResponse_)
- response_.Dispose();
- }
+ if (ReadResponseAsString)
+ {
+ var responseText = await response.Content.ReadAsStringAsync().ConfigureAwait(false);
+ try
+ {
+ var typedBody = Newtonsoft.Json.JsonConvert.DeserializeObject(responseText, JsonSerializerSettings);
+ return new ObjectResponseResult(typedBody!, responseText);
+ }
+ catch (Newtonsoft.Json.JsonException exception)
+ {
+ var message = "Could not deserialize the response body string as " + typeof(T).FullName + ".";
+ throw new DevilDaggersInfoApiException(message, (int)response.StatusCode, responseText, headers, exception);
}
}
- finally
+ else
{
- if (disposeClient_)
- client_.Dispose();
+ try
+ {
+ using (var responseStream = await response.Content.ReadAsStreamAsync().ConfigureAwait(false))
+ using (var streamReader = new System.IO.StreamReader(responseStream))
+ using (var jsonTextReader = new Newtonsoft.Json.JsonTextReader(streamReader))
+ {
+ var serializer = Newtonsoft.Json.JsonSerializer.Create(JsonSerializerSettings);
+ var typedBody = serializer.Deserialize(jsonTextReader);
+ return new ObjectResponseResult(typedBody!, string.Empty);
+ }
+ }
+ catch (Newtonsoft.Json.JsonException exception)
+ {
+ var message = "Could not deserialize the response body stream as " + typeof(T).FullName + ".";
+ throw new DevilDaggersInfoApiException(message, (int)response.StatusCode, string.Empty, headers, exception);
+ }
}
}
- /// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
- /// A server side error occurred.
- public virtual async System.Threading.Tasks.Task CustomLeaderboards_GetCustomLeaderboardsAsync(CustomLeaderboardCategory? category = null, string? spawnsetFilter = null, string? authorFilter = null, int? pageIndex = null, int? pageSize = null, CustomLeaderboardSorting? sortBy = null, bool? ascending = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
+ private string ConvertToString(object? value, System.Globalization.CultureInfo cultureInfo)
{
- var urlBuilder_ = new System.Text.StringBuilder();
- urlBuilder_.Append("api/custom-leaderboards?");
- if (category != null)
- {
- urlBuilder_.Append(System.Uri.EscapeDataString("category") + "=").Append(System.Uri.EscapeDataString(ConvertToString(category, System.Globalization.CultureInfo.InvariantCulture))).Append("&");
- }
- if (spawnsetFilter != null)
- {
- urlBuilder_.Append(System.Uri.EscapeDataString("spawnsetFilter") + "=").Append(System.Uri.EscapeDataString(ConvertToString(spawnsetFilter, System.Globalization.CultureInfo.InvariantCulture))).Append("&");
- }
- if (authorFilter != null)
+ if (value == null)
{
- urlBuilder_.Append(System.Uri.EscapeDataString("authorFilter") + "=").Append(System.Uri.EscapeDataString(ConvertToString(authorFilter, System.Globalization.CultureInfo.InvariantCulture))).Append("&");
+ return "";
}
- if (pageIndex != null)
+
+ if (value is System.Enum)
{
- urlBuilder_.Append(System.Uri.EscapeDataString("pageIndex") + "=").Append(System.Uri.EscapeDataString(ConvertToString(pageIndex, System.Globalization.CultureInfo.InvariantCulture))).Append("&");
+ var name = System.Enum.GetName(value.GetType(), value);
+ if (name != null)
+ {
+ var field = System.Reflection.IntrospectionExtensions.GetTypeInfo(value.GetType()).GetDeclaredField(name);
+ if (field != null)
+ {
+ var attribute = System.Reflection.CustomAttributeExtensions.GetCustomAttribute(field, typeof(System.Runtime.Serialization.EnumMemberAttribute))
+ as System.Runtime.Serialization.EnumMemberAttribute;
+ if (attribute != null)
+ {
+ return attribute.Value != null ? attribute.Value : name;
+ }
+ }
+
+ var converted = System.Convert.ToString(System.Convert.ChangeType(value, System.Enum.GetUnderlyingType(value.GetType()), cultureInfo));
+ return converted == null ? string.Empty : converted;
+ }
}
- if (pageSize != null)
+ else if (value is bool)
{
- urlBuilder_.Append(System.Uri.EscapeDataString("pageSize") + "=").Append(System.Uri.EscapeDataString(ConvertToString(pageSize, System.Globalization.CultureInfo.InvariantCulture))).Append("&");
+ return System.Convert.ToString((bool)value, cultureInfo).ToLowerInvariant();
}
- if (sortBy != null)
+ else if (value is byte[])
{
- urlBuilder_.Append(System.Uri.EscapeDataString("sortBy") + "=").Append(System.Uri.EscapeDataString(ConvertToString(sortBy, System.Globalization.CultureInfo.InvariantCulture))).Append("&");
+ return System.Convert.ToBase64String((byte[]) value);
}
- if (ascending != null)
+ else if (value is string[])
{
- urlBuilder_.Append(System.Uri.EscapeDataString("ascending") + "=").Append(System.Uri.EscapeDataString(ConvertToString(ascending, System.Globalization.CultureInfo.InvariantCulture))).Append("&");
+ return string.Join(",", (string[])value);
}
- urlBuilder_.Length--;
-
- var client_ = _httpClient;
- var disposeClient_ = false;
- try
+ else if (value.GetType().IsArray)
{
- using (var request_ = new System.Net.Http.HttpRequestMessage())
+ var valueArray = (System.Array)value;
+ var valueTextArray = new string[valueArray.Length];
+ for (var i = 0; i < valueArray.Length; i++)
{
- request_.Method = new System.Net.Http.HttpMethod("GET");
- request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json"));
-
- PrepareRequest(client_, request_, urlBuilder_);
-
- var url_ = urlBuilder_.ToString();
- request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute);
-
- PrepareRequest(client_, request_, url_);
-
- var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false);
- var disposeResponse_ = true;
- try
- {
- var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value);
- if (response_.Content != null && response_.Content.Headers != null)
- {
- foreach (var item_ in response_.Content.Headers)
- headers_[item_.Key] = item_.Value;
- }
-
- ProcessResponse(client_, response_);
-
- var status_ = (int)response_.StatusCode;
- if (status_ == 200)
- {
- var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false);
- if (objectResponse_.Object == null)
- {
- throw new DevilDaggersInfoApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null);
- }
- return objectResponse_.Object;
- }
- else
- if (status_ == 400)
- {
- var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false);
- if (objectResponse_.Object == null)
- {
- throw new DevilDaggersInfoApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null);
- }
- throw new DevilDaggersInfoApiException("A server side error occurred.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null);
- }
- else
- {
- var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false);
- throw new DevilDaggersInfoApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null);
- }
- }
- finally
- {
- if (disposeResponse_)
- response_.Dispose();
- }
- }
- }
- finally
- {
- if (disposeClient_)
- client_.Dispose();
- }
- }
-
- /// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
- /// A server side error occurred.
- public virtual async System.Threading.Tasks.Task CustomLeaderboards_GetGlobalCustomLeaderboardForCategoryAsync(CustomLeaderboardCategory? category = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
- {
- var urlBuilder_ = new System.Text.StringBuilder();
- urlBuilder_.Append("api/custom-leaderboards/global-leaderboard?");
- if (category != null)
- {
- urlBuilder_.Append(System.Uri.EscapeDataString("category") + "=").Append(System.Uri.EscapeDataString(ConvertToString(category, System.Globalization.CultureInfo.InvariantCulture))).Append("&");
- }
- urlBuilder_.Length--;
-
- var client_ = _httpClient;
- var disposeClient_ = false;
- try
- {
- using (var request_ = new System.Net.Http.HttpRequestMessage())
- {
- request_.Method = new System.Net.Http.HttpMethod("GET");
- request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json"));
-
- PrepareRequest(client_, request_, urlBuilder_);
-
- var url_ = urlBuilder_.ToString();
- request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute);
-
- PrepareRequest(client_, request_, url_);
-
- var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false);
- var disposeResponse_ = true;
- try
- {
- var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value);
- if (response_.Content != null && response_.Content.Headers != null)
- {
- foreach (var item_ in response_.Content.Headers)
- headers_[item_.Key] = item_.Value;
- }
-
- ProcessResponse(client_, response_);
-
- var status_ = (int)response_.StatusCode;
- if (status_ == 200)
- {
- var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false);
- if (objectResponse_.Object == null)
- {
- throw new DevilDaggersInfoApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null);
- }
- return objectResponse_.Object;
- }
- else
- if (status_ == 400)
- {
- var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false);
- if (objectResponse_.Object == null)
- {
- throw new DevilDaggersInfoApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null);
- }
- throw new DevilDaggersInfoApiException("A server side error occurred.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null);
- }
- else
- {
- var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false);
- throw new DevilDaggersInfoApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null);
- }
- }
- finally
- {
- if (disposeResponse_)
- response_.Dispose();
- }
- }
- }
- finally
- {
- if (disposeClient_)
- client_.Dispose();
- }
- }
-
- /// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
- /// A server side error occurred.
- public virtual async System.Threading.Tasks.Task> CustomLeaderboards_GetCustomLeaderboardsOverviewDdLiveAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
- {
- var urlBuilder_ = new System.Text.StringBuilder();
- urlBuilder_.Append("api/custom-leaderboards/ddlive");
-
- var client_ = _httpClient;
- var disposeClient_ = false;
- try
- {
- using (var request_ = new System.Net.Http.HttpRequestMessage())
- {
- request_.Method = new System.Net.Http.HttpMethod("GET");
- request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json"));
-
- PrepareRequest(client_, request_, urlBuilder_);
-
- var url_ = urlBuilder_.ToString();
- request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute);
-
- PrepareRequest(client_, request_, url_);
-
- var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false);
- var disposeResponse_ = true;
- try
- {
- var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value);
- if (response_.Content != null && response_.Content.Headers != null)
- {
- foreach (var item_ in response_.Content.Headers)
- headers_[item_.Key] = item_.Value;
- }
-
- ProcessResponse(client_, response_);
-
- var status_ = (int)response_.StatusCode;
- if (status_ == 200)
- {
- var objectResponse_ = await ReadObjectResponseAsync>(response_, headers_, cancellationToken).ConfigureAwait(false);
- if (objectResponse_.Object == null)
- {
- throw new DevilDaggersInfoApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null);
- }
- return objectResponse_.Object;
- }
- else
- if (status_ == 400)
- {
- var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false);
- if (objectResponse_.Object == null)
- {
- throw new DevilDaggersInfoApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null);
- }
- throw new DevilDaggersInfoApiException("A server side error occurred.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null);
- }
- else
- {
- var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false);
- throw new DevilDaggersInfoApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null);
- }
- }
- finally
- {
- if (disposeResponse_)
- response_.Dispose();
- }
- }
- }
- finally
- {
- if (disposeClient_)
- client_.Dispose();
- }
- }
-
- /// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
- /// A server side error occurred.
- public virtual async System.Threading.Tasks.Task CustomLeaderboards_GetTotalCustomLeaderboardDataAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
- {
- var urlBuilder_ = new System.Text.StringBuilder();
- urlBuilder_.Append("api/custom-leaderboards/total-data");
-
- var client_ = _httpClient;
- var disposeClient_ = false;
- try
- {
- using (var request_ = new System.Net.Http.HttpRequestMessage())
- {
- request_.Method = new System.Net.Http.HttpMethod("GET");
- request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json"));
-
- PrepareRequest(client_, request_, urlBuilder_);
-
- var url_ = urlBuilder_.ToString();
- request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute);
-
- PrepareRequest(client_, request_, url_);
-
- var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false);
- var disposeResponse_ = true;
- try
- {
- var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value);
- if (response_.Content != null && response_.Content.Headers != null)
- {
- foreach (var item_ in response_.Content.Headers)
- headers_[item_.Key] = item_.Value;
- }
-
- ProcessResponse(client_, response_);
-
- var status_ = (int)response_.StatusCode;
- if (status_ == 200)
- {
- var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false);
- if (objectResponse_.Object == null)
- {
- throw new DevilDaggersInfoApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null);
- }
- return objectResponse_.Object;
- }
- else
- {
- var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false);
- throw new DevilDaggersInfoApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null);
- }
- }
- finally
- {
- if (disposeResponse_)
- response_.Dispose();
- }
- }
- }
- finally
- {
- if (disposeClient_)
- client_.Dispose();
- }
- }
-
- /// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
- /// A server side error occurred.
- public virtual async System.Threading.Tasks.Task CustomLeaderboards_GetCustomLeaderboardByIdAsync(int id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
- {
- if (id == null)
- throw new System.ArgumentNullException("id");
-
- var urlBuilder_ = new System.Text.StringBuilder();
- urlBuilder_.Append("api/custom-leaderboards/{id}");
- urlBuilder_.Replace("{id}", System.Uri.EscapeDataString(ConvertToString(id, System.Globalization.CultureInfo.InvariantCulture)));
-
- var client_ = _httpClient;
- var disposeClient_ = false;
- try
- {
- using (var request_ = new System.Net.Http.HttpRequestMessage())
- {
- request_.Method = new System.Net.Http.HttpMethod("GET");
- request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json"));
-
- PrepareRequest(client_, request_, urlBuilder_);
-
- var url_ = urlBuilder_.ToString();
- request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute);
-
- PrepareRequest(client_, request_, url_);
-
- var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false);
- var disposeResponse_ = true;
- try
- {
- var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value);
- if (response_.Content != null && response_.Content.Headers != null)
- {
- foreach (var item_ in response_.Content.Headers)
- headers_[item_.Key] = item_.Value;
- }
-
- ProcessResponse(client_, response_);
-
- var status_ = (int)response_.StatusCode;
- if (status_ == 200)
- {
- var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false);
- if (objectResponse_.Object == null)
- {
- throw new DevilDaggersInfoApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null);
- }
- return objectResponse_.Object;
- }
- else
- if (status_ == 404)
- {
- var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false);
- if (objectResponse_.Object == null)
- {
- throw new DevilDaggersInfoApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null);
- }
- throw new DevilDaggersInfoApiException("A server side error occurred.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null);
- }
- else
- {
- var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false);
- throw new DevilDaggersInfoApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null);
- }
- }
- finally
- {
- if (disposeResponse_)
- response_.Dispose();
- }
- }
- }
- finally
- {
- if (disposeClient_)
- client_.Dispose();
- }
- }
-
- /// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
- /// A server side error occurred.
- public virtual async System.Threading.Tasks.Task CustomLeaderboards_GetCustomLeaderboardByIdDdLiveAsync(int id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
- {
- if (id == null)
- throw new System.ArgumentNullException("id");
-
- var urlBuilder_ = new System.Text.StringBuilder();
- urlBuilder_.Append("api/custom-leaderboards/{id}/ddlive");
- urlBuilder_.Replace("{id}", System.Uri.EscapeDataString(ConvertToString(id, System.Globalization.CultureInfo.InvariantCulture)));
-
- var client_ = _httpClient;
- var disposeClient_ = false;
- try
- {
- using (var request_ = new System.Net.Http.HttpRequestMessage())
- {
- request_.Method = new System.Net.Http.HttpMethod("GET");
- request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json"));
-
- PrepareRequest(client_, request_, urlBuilder_);
-
- var url_ = urlBuilder_.ToString();
- request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute);
-
- PrepareRequest(client_, request_, url_);
-
- var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false);
- var disposeResponse_ = true;
- try
- {
- var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value);
- if (response_.Content != null && response_.Content.Headers != null)
- {
- foreach (var item_ in response_.Content.Headers)
- headers_[item_.Key] = item_.Value;
- }
-
- ProcessResponse(client_, response_);
-
- var status_ = (int)response_.StatusCode;
- if (status_ == 200)
- {
- var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false);
- if (objectResponse_.Object == null)
- {
- throw new DevilDaggersInfoApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null);
- }
- return objectResponse_.Object;
- }
- else
- if (status_ == 404)
- {
- var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false);
- if (objectResponse_.Object == null)
- {
- throw new DevilDaggersInfoApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null);
- }
- throw new DevilDaggersInfoApiException("A server side error occurred.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null);
- }
- else
- {
- var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false);
- throw new DevilDaggersInfoApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null);
- }
- }
- finally
- {
- if (disposeResponse_)
- response_.Dispose();
- }
- }
- }
- finally
- {
- if (disposeClient_)
- client_.Dispose();
- }
- }
-
- /// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
- /// A server side error occurred.
- public virtual async System.Threading.Tasks.Task> Donations_GetDonatorsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
- {
- var urlBuilder_ = new System.Text.StringBuilder();
- urlBuilder_.Append("api/donations/donators");
-
- var client_ = _httpClient;
- var disposeClient_ = false;
- try
- {
- using (var request_ = new System.Net.Http.HttpRequestMessage())
- {
- request_.Method = new System.Net.Http.HttpMethod("GET");
- request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json"));
-
- PrepareRequest(client_, request_, urlBuilder_);
-
- var url_ = urlBuilder_.ToString();
- request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute);
-
- PrepareRequest(client_, request_, url_);
-
- var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false);
- var disposeResponse_ = true;
- try
- {
- var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value);
- if (response_.Content != null && response_.Content.Headers != null)
- {
- foreach (var item_ in response_.Content.Headers)
- headers_[item_.Key] = item_.Value;
- }
-
- ProcessResponse(client_, response_);
-
- var status_ = (int)response_.StatusCode;
- if (status_ == 200)
- {
- var objectResponse_ = await ReadObjectResponseAsync>(response_, headers_, cancellationToken).ConfigureAwait(false);
- if (objectResponse_.Object == null)
- {
- throw new DevilDaggersInfoApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null);
- }
- return objectResponse_.Object;
- }
- else
- {
- var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false);
- throw new DevilDaggersInfoApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null);
- }
- }
- finally
- {
- if (disposeResponse_)
- response_.Dispose();
- }
- }
- }
- finally
- {
- if (disposeClient_)
- client_.Dispose();
- }
- }
-
- /// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
- /// A server side error occurred.
- public virtual async System.Threading.Tasks.Task Integrations_GetDdstatsRustAccessInfoAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
- {
- var urlBuilder_ = new System.Text.StringBuilder();
- urlBuilder_.Append("api/integrations/ddstats-rust");
-
- var client_ = _httpClient;
- var disposeClient_ = false;
- try
- {
- using (var request_ = new System.Net.Http.HttpRequestMessage())
- {
- request_.Method = new System.Net.Http.HttpMethod("GET");
- request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json"));
-
- PrepareRequest(client_, request_, urlBuilder_);
-
- var url_ = urlBuilder_.ToString();
- request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute);
-
- PrepareRequest(client_, request_, url_);
-
- var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false);
- var disposeResponse_ = true;
- try
- {
- var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value);
- if (response_.Content != null && response_.Content.Headers != null)
- {
- foreach (var item_ in response_.Content.Headers)
- headers_[item_.Key] = item_.Value;
- }
-
- ProcessResponse(client_, response_);
-
- var status_ = (int)response_.StatusCode;
- if (status_ == 200)
- {
- var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false);
- if (objectResponse_.Object == null)
- {
- throw new DevilDaggersInfoApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null);
- }
- return objectResponse_.Object;
- }
- else
- {
- var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false);
- throw new DevilDaggersInfoApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null);
- }
- }
- finally
- {
- if (disposeResponse_)
- response_.Dispose();
- }
- }
- }
- finally
- {
- if (disposeClient_)
- client_.Dispose();
- }
- }
-
- /// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
- /// A server side error occurred.
- public virtual async System.Threading.Tasks.Task LeaderboardHistory_GetLeaderboardHistoryAsync(System.DateTime? dateTime = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
- {
- var urlBuilder_ = new System.Text.StringBuilder();
- urlBuilder_.Append("api/leaderboard-history?");
- if (dateTime != null)
- {
- urlBuilder_.Append(System.Uri.EscapeDataString("dateTime") + "=").Append(System.Uri.EscapeDataString(dateTime.Value.ToString("s", System.Globalization.CultureInfo.InvariantCulture))).Append("&");
- }
- urlBuilder_.Length--;
-
- var client_ = _httpClient;
- var disposeClient_ = false;
- try
- {
- using (var request_ = new System.Net.Http.HttpRequestMessage())
- {
- request_.Method = new System.Net.Http.HttpMethod("GET");
- request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json"));
-
- PrepareRequest(client_, request_, urlBuilder_);
-
- var url_ = urlBuilder_.ToString();
- request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute);
-
- PrepareRequest(client_, request_, url_);
-
- var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false);
- var disposeResponse_ = true;
- try
- {
- var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value);
- if (response_.Content != null && response_.Content.Headers != null)
- {
- foreach (var item_ in response_.Content.Headers)
- headers_[item_.Key] = item_.Value;
- }
-
- ProcessResponse(client_, response_);
-
- var status_ = (int)response_.StatusCode;
- if (status_ == 200)
- {
- var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false);
- if (objectResponse_.Object == null)
- {
- throw new DevilDaggersInfoApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null);
- }
- return objectResponse_.Object;
- }
- else
- if (status_ == 400)
- {
- var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false);
- if (objectResponse_.Object == null)
- {
- throw new DevilDaggersInfoApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null);
- }
- throw new DevilDaggersInfoApiException("A server side error occurred.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null);
- }
- else
- {
- var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false);
- throw new DevilDaggersInfoApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null);
- }
- }
- finally
- {
- if (disposeResponse_)
- response_.Dispose();
- }
- }
- }
- finally
- {
- if (disposeClient_)
- client_.Dispose();
- }
- }
-
- /// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
- /// A server side error occurred.
- public virtual async System.Threading.Tasks.Task> LeaderboardHistoryStatistics_GetLeaderboardHistoryStatisticsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
- {
- var urlBuilder_ = new System.Text.StringBuilder();
- urlBuilder_.Append("api/leaderboard-history-statistics");
-
- var client_ = _httpClient;
- var disposeClient_ = false;
- try
- {
- using (var request_ = new System.Net.Http.HttpRequestMessage())
- {
- request_.Method = new System.Net.Http.HttpMethod("GET");
- request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json"));
-
- PrepareRequest(client_, request_, urlBuilder_);
-
- var url_ = urlBuilder_.ToString();
- request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute);
-
- PrepareRequest(client_, request_, url_);
-
- var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false);
- var disposeResponse_ = true;
- try
- {
- var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value);
- if (response_.Content != null && response_.Content.Headers != null)
- {
- foreach (var item_ in response_.Content.Headers)
- headers_[item_.Key] = item_.Value;
- }
-
- ProcessResponse(client_, response_);
-
- var status_ = (int)response_.StatusCode;
- if (status_ == 200)
- {
- var objectResponse_ = await ReadObjectResponseAsync>(response_, headers_, cancellationToken).ConfigureAwait(false);
- if (objectResponse_.Object == null)
- {
- throw new DevilDaggersInfoApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null);
- }
- return objectResponse_.Object;
- }
- else
- if (status_ == 400)
- {
- var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false);
- if (objectResponse_.Object == null)
- {
- throw new DevilDaggersInfoApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null);
- }
- throw new DevilDaggersInfoApiException("A server side error occurred.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null);
- }
- else
- {
- var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false);
- throw new DevilDaggersInfoApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null);
- }
- }
- finally
- {
- if (disposeResponse_)
- response_.Dispose();
- }
- }
- }
- finally
- {
- if (disposeClient_)
- client_.Dispose();
- }
- }
-
- /// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
- /// A server side error occurred.
- public virtual async System.Threading.Tasks.Task Leaderboards_GetLeaderboardAsync(int? rankStart = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
- {
- var urlBuilder_ = new System.Text.StringBuilder();
- urlBuilder_.Append("api/leaderboards?");
- if (rankStart != null)
- {
- urlBuilder_.Append(System.Uri.EscapeDataString("rankStart") + "=").Append(System.Uri.EscapeDataString(ConvertToString(rankStart, System.Globalization.CultureInfo.InvariantCulture))).Append("&");
- }
- urlBuilder_.Length--;
-
- var client_ = _httpClient;
- var disposeClient_ = false;
- try
- {
- using (var request_ = new System.Net.Http.HttpRequestMessage())
- {
- request_.Method = new System.Net.Http.HttpMethod("GET");
- request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json"));
-
- PrepareRequest(client_, request_, urlBuilder_);
-
- var url_ = urlBuilder_.ToString();
- request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute);
-
- PrepareRequest(client_, request_, url_);
-
- var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false);
- var disposeResponse_ = true;
- try
- {
- var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value);
- if (response_.Content != null && response_.Content.Headers != null)
- {
- foreach (var item_ in response_.Content.Headers)
- headers_[item_.Key] = item_.Value;
- }
-
- ProcessResponse(client_, response_);
-
- var status_ = (int)response_.StatusCode;
- if (status_ == 200)
- {
- var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false);
- if (objectResponse_.Object == null)
- {
- throw new DevilDaggersInfoApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null);
- }
- return objectResponse_.Object;
- }
- else
- if (status_ == 400)
- {
- var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false);
- if (objectResponse_.Object == null)
- {
- throw new DevilDaggersInfoApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null);
- }
- throw new DevilDaggersInfoApiException("A server side error occurred.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null);
- }
- else
- {
- var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false);
- throw new DevilDaggersInfoApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null);
- }
- }
- finally
- {
- if (disposeResponse_)
- response_.Dispose();
- }
- }
- }
- finally
- {
- if (disposeClient_)
- client_.Dispose();
- }
- }
-
- /// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
- /// A server side error occurred.
- public virtual async System.Threading.Tasks.Task Leaderboards_GetEntryByIdAsync(int? id = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
- {
- var urlBuilder_ = new System.Text.StringBuilder();
- urlBuilder_.Append("api/leaderboards/entry/by-id?");
- if (id != null)
- {
- urlBuilder_.Append(System.Uri.EscapeDataString("id") + "=").Append(System.Uri.EscapeDataString(ConvertToString(id, System.Globalization.CultureInfo.InvariantCulture))).Append("&");
- }
- urlBuilder_.Length--;
-
- var client_ = _httpClient;
- var disposeClient_ = false;
- try
- {
- using (var request_ = new System.Net.Http.HttpRequestMessage())
- {
- request_.Method = new System.Net.Http.HttpMethod("GET");
- request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json"));
-
- PrepareRequest(client_, request_, urlBuilder_);
-
- var url_ = urlBuilder_.ToString();
- request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute);
-
- PrepareRequest(client_, request_, url_);
-
- var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false);
- var disposeResponse_ = true;
- try
- {
- var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value);
- if (response_.Content != null && response_.Content.Headers != null)
- {
- foreach (var item_ in response_.Content.Headers)
- headers_[item_.Key] = item_.Value;
- }
-
- ProcessResponse(client_, response_);
-
- var status_ = (int)response_.StatusCode;
- if (status_ == 200)
- {
- var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false);
- if (objectResponse_.Object == null)
- {
- throw new DevilDaggersInfoApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null);
- }
- return objectResponse_.Object;
- }
- else
- if (status_ == 400)
- {
- var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false);
- if (objectResponse_.Object == null)
- {
- throw new DevilDaggersInfoApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null);
- }
- throw new DevilDaggersInfoApiException("A server side error occurred.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null);
- }
- else
- {
- var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false);
- throw new DevilDaggersInfoApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null);
- }
- }
- finally
- {
- if (disposeResponse_)
- response_.Dispose();
- }
- }
- }
- finally
- {
- if (disposeClient_)
- client_.Dispose();
- }
- }
-
- /// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
- /// A server side error occurred.
- public virtual async System.Threading.Tasks.Task> Leaderboards_GetEntriesByIdsAsync(string? commaSeparatedIds = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
- {
- var urlBuilder_ = new System.Text.StringBuilder();
- urlBuilder_.Append("api/leaderboards/entry/by-ids?");
- if (commaSeparatedIds != null)
- {
- urlBuilder_.Append(System.Uri.EscapeDataString("commaSeparatedIds") + "=").Append(System.Uri.EscapeDataString(ConvertToString(commaSeparatedIds, System.Globalization.CultureInfo.InvariantCulture))).Append("&");
- }
- urlBuilder_.Length--;
-
- var client_ = _httpClient;
- var disposeClient_ = false;
- try
- {
- using (var request_ = new System.Net.Http.HttpRequestMessage())
- {
- request_.Method = new System.Net.Http.HttpMethod("GET");
- request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json"));
-
- PrepareRequest(client_, request_, urlBuilder_);
-
- var url_ = urlBuilder_.ToString();
- request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute);
-
- PrepareRequest(client_, request_, url_);
-
- var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false);
- var disposeResponse_ = true;
- try
- {
- var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value);
- if (response_.Content != null && response_.Content.Headers != null)
- {
- foreach (var item_ in response_.Content.Headers)
- headers_[item_.Key] = item_.Value;
- }
-
- ProcessResponse(client_, response_);
-
- var status_ = (int)response_.StatusCode;
- if (status_ == 200)
- {
- var objectResponse_ = await ReadObjectResponseAsync>(response_, headers_, cancellationToken).ConfigureAwait(false);
- if (objectResponse_.Object == null)
- {
- throw new DevilDaggersInfoApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null);
- }
- return objectResponse_.Object;
- }
- else
- if (status_ == 400)
- {
- var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false);
- if (objectResponse_.Object == null)
- {
- throw new DevilDaggersInfoApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null);
- }
- throw new DevilDaggersInfoApiException("A server side error occurred.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null);
- }
- else
- {
- var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false);
- throw new DevilDaggersInfoApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null);
- }
- }
- finally
- {
- if (disposeResponse_)
- response_.Dispose();
- }
- }
- }
- finally
- {
- if (disposeClient_)
- client_.Dispose();
- }
- }
-
- /// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
- /// A server side error occurred.
- public virtual async System.Threading.Tasks.Task> Leaderboards_GetEntriesByNameAsync(string? name = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
- {
- var urlBuilder_ = new System.Text.StringBuilder();
- urlBuilder_.Append("api/leaderboards/entry/by-username?");
- if (name != null)
- {
- urlBuilder_.Append(System.Uri.EscapeDataString("name") + "=").Append(System.Uri.EscapeDataString(ConvertToString(name, System.Globalization.CultureInfo.InvariantCulture))).Append("&");
- }
- urlBuilder_.Length--;
-
- var client_ = _httpClient;
- var disposeClient_ = false;
- try
- {
- using (var request_ = new System.Net.Http.HttpRequestMessage())
- {
- request_.Method = new System.Net.Http.HttpMethod("GET");
- request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json"));
-
- PrepareRequest(client_, request_, urlBuilder_);
-
- var url_ = urlBuilder_.ToString();
- request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute);
-
- PrepareRequest(client_, request_, url_);
-
- var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false);
- var disposeResponse_ = true;
- try
- {
- var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value);
- if (response_.Content != null && response_.Content.Headers != null)
- {
- foreach (var item_ in response_.Content.Headers)
- headers_[item_.Key] = item_.Value;
- }
-
- ProcessResponse(client_, response_);
-
- var status_ = (int)response_.StatusCode;
- if (status_ == 200)
- {
- var objectResponse_ = await ReadObjectResponseAsync>(response_, headers_, cancellationToken).ConfigureAwait(false);
- if (objectResponse_.Object == null)
- {
- throw new DevilDaggersInfoApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null);
- }
- return objectResponse_.Object;
- }
- else
- if (status_ == 400)
- {
- var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false);
- if (objectResponse_.Object == null)
- {
- throw new DevilDaggersInfoApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null);
- }
- throw new DevilDaggersInfoApiException("A server side error occurred.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null);
- }
- else
- {
- var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false);
- throw new DevilDaggersInfoApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null);
- }
- }
- finally
- {
- if (disposeResponse_)
- response_.Dispose();
- }
- }
- }
- finally
- {
- if (disposeClient_)
- client_.Dispose();
- }
- }
-
- /// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
- /// A server side error occurred.
- public virtual async System.Threading.Tasks.Task Leaderboards_GetEntryByRankAsync(int? rank = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
- {
- var urlBuilder_ = new System.Text.StringBuilder();
- urlBuilder_.Append("api/leaderboards/entry/by-rank?");
- if (rank != null)
- {
- urlBuilder_.Append(System.Uri.EscapeDataString("rank") + "=").Append(System.Uri.EscapeDataString(ConvertToString(rank, System.Globalization.CultureInfo.InvariantCulture))).Append("&");
- }
- urlBuilder_.Length--;
-
- var client_ = _httpClient;
- var disposeClient_ = false;
- try
- {
- using (var request_ = new System.Net.Http.HttpRequestMessage())
- {
- request_.Method = new System.Net.Http.HttpMethod("GET");
- request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json"));
-
- PrepareRequest(client_, request_, urlBuilder_);
-
- var url_ = urlBuilder_.ToString();
- request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute);
-
- PrepareRequest(client_, request_, url_);
-
- var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false);
- var disposeResponse_ = true;
- try
- {
- var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value);
- if (response_.Content != null && response_.Content.Headers != null)
- {
- foreach (var item_ in response_.Content.Headers)
- headers_[item_.Key] = item_.Value;
- }
-
- ProcessResponse(client_, response_);
-
- var status_ = (int)response_.StatusCode;
- if (status_ == 200)
- {
- var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false);
- if (objectResponse_.Object == null)
- {
- throw new DevilDaggersInfoApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null);
- }
- return objectResponse_.Object;
- }
- else
- if (status_ == 400)
- {
- var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false);
- if (objectResponse_.Object == null)
- {
- throw new DevilDaggersInfoApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null);
- }
- throw new DevilDaggersInfoApiException("A server side error occurred.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null);
- }
- else
- if (status_ == 404)
- {
- var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false);
- if (objectResponse_.Object == null)
- {
- throw new DevilDaggersInfoApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null);
- }
- throw new DevilDaggersInfoApiException("A server side error occurred.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null);
- }
- else
- {
- var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false);
- throw new DevilDaggersInfoApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null);
- }
- }
- finally
- {
- if (disposeResponse_)
- response_.Dispose();
- }
- }
- }
- finally
- {
- if (disposeClient_)
- client_.Dispose();
- }
- }
-
- /// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
- /// A server side error occurred.
- public virtual async System.Threading.Tasks.Task LeaderboardStatistics_GetLeaderboardStatisticsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
- {
- var urlBuilder_ = new System.Text.StringBuilder();
- urlBuilder_.Append("api/leaderboard-statistics");
-
- var client_ = _httpClient;
- var disposeClient_ = false;
- try
- {
- using (var request_ = new System.Net.Http.HttpRequestMessage())
- {
- request_.Method = new System.Net.Http.HttpMethod("GET");
- request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json"));
-
- PrepareRequest(client_, request_, urlBuilder_);
-
- var url_ = urlBuilder_.ToString();
- request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute);
-
- PrepareRequest(client_, request_, url_);
-
- var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false);
- var disposeResponse_ = true;
- try
- {
- var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value);
- if (response_.Content != null && response_.Content.Headers != null)
- {
- foreach (var item_ in response_.Content.Headers)
- headers_[item_.Key] = item_.Value;
- }
-
- ProcessResponse(client_, response_);
-
- var status_ = (int)response_.StatusCode;
- if (status_ == 200)
- {
- var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false);
- if (objectResponse_.Object == null)
- {
- throw new DevilDaggersInfoApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null);
- }
- return objectResponse_.Object;
- }
- else
- {
- var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false);
- throw new DevilDaggersInfoApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null);
- }
- }
- finally
- {
- if (disposeResponse_)
- response_.Dispose();
- }
- }
- }
- finally
- {
- if (disposeClient_)
- client_.Dispose();
- }
- }
-
- /// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
- /// A server side error occurred.
- public virtual async System.Threading.Tasks.Task LeaderboardStatistics_GetLeaderboardStatisticsDdLiveAsync(LeaderboardStatisticsLimitDdLive? top = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
- {
- var urlBuilder_ = new System.Text.StringBuilder();
- urlBuilder_.Append("api/leaderboard-statistics/ddlive?");
- if (top != null)
- {
- urlBuilder_.Append(System.Uri.EscapeDataString("top") + "=").Append(System.Uri.EscapeDataString(ConvertToString(top, System.Globalization.CultureInfo.InvariantCulture))).Append("&");
- }
- urlBuilder_.Length--;
-
- var client_ = _httpClient;
- var disposeClient_ = false;
- try
- {
- using (var request_ = new System.Net.Http.HttpRequestMessage())
- {
- request_.Method = new System.Net.Http.HttpMethod("GET");
- request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json"));
-
- PrepareRequest(client_, request_, urlBuilder_);
-
- var url_ = urlBuilder_.ToString();
- request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute);
-
- PrepareRequest(client_, request_, url_);
-
- var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false);
- var disposeResponse_ = true;
- try
- {
- var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value);
- if (response_.Content != null && response_.Content.Headers != null)
- {
- foreach (var item_ in response_.Content.Headers)
- headers_[item_.Key] = item_.Value;
- }
-
- ProcessResponse(client_, response_);
-
- var status_ = (int)response_.StatusCode;
- if (status_ == 200)
- {
- var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false);
- if (objectResponse_.Object == null)
- {
- throw new DevilDaggersInfoApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null);
- }
- return objectResponse_.Object;
- }
- else
- {
- var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false);
- throw new DevilDaggersInfoApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null);
- }
- }
- finally
- {
- if (disposeResponse_)
- response_.Dispose();
- }
- }
- }
- finally
- {
- if (disposeClient_)
- client_.Dispose();
- }
- }
-
- /// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
- /// A server side error occurred.
- public virtual async System.Threading.Tasks.Task Mods_GetModsAsync(bool? onlyHosted = null, string? modFilter = null, string? authorFilter = null, int? pageIndex = null, int? pageSize = null, ModSorting? sortBy = null, bool? ascending = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
- {
- var urlBuilder_ = new System.Text.StringBuilder();
- urlBuilder_.Append("api/mods?");
- if (onlyHosted != null)
- {
- urlBuilder_.Append(System.Uri.EscapeDataString("onlyHosted") + "=").Append(System.Uri.EscapeDataString(ConvertToString(onlyHosted, System.Globalization.CultureInfo.InvariantCulture))).Append("&");
- }
- if (modFilter != null)
- {
- urlBuilder_.Append(System.Uri.EscapeDataString("modFilter") + "=").Append(System.Uri.EscapeDataString(ConvertToString(modFilter, System.Globalization.CultureInfo.InvariantCulture))).Append("&");
- }
- if (authorFilter != null)
- {
- urlBuilder_.Append(System.Uri.EscapeDataString("authorFilter") + "=").Append(System.Uri.EscapeDataString(ConvertToString(authorFilter, System.Globalization.CultureInfo.InvariantCulture))).Append("&");
- }
- if (pageIndex != null)
- {
- urlBuilder_.Append(System.Uri.EscapeDataString("pageIndex") + "=").Append(System.Uri.EscapeDataString(ConvertToString(pageIndex, System.Globalization.CultureInfo.InvariantCulture))).Append("&");
- }
- if (pageSize != null)
- {
- urlBuilder_.Append(System.Uri.EscapeDataString("pageSize") + "=").Append(System.Uri.EscapeDataString(ConvertToString(pageSize, System.Globalization.CultureInfo.InvariantCulture))).Append("&");
- }
- if (sortBy != null)
- {
- urlBuilder_.Append(System.Uri.EscapeDataString("sortBy") + "=").Append(System.Uri.EscapeDataString(ConvertToString(sortBy, System.Globalization.CultureInfo.InvariantCulture))).Append("&");
- }
- if (ascending != null)
- {
- urlBuilder_.Append(System.Uri.EscapeDataString("ascending") + "=").Append(System.Uri.EscapeDataString(ConvertToString(ascending, System.Globalization.CultureInfo.InvariantCulture))).Append("&");
- }
- urlBuilder_.Length--;
-
- var client_ = _httpClient;
- var disposeClient_ = false;
- try
- {
- using (var request_ = new System.Net.Http.HttpRequestMessage())
- {
- request_.Method = new System.Net.Http.HttpMethod("GET");
- request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json"));
-
- PrepareRequest(client_, request_, urlBuilder_);
-
- var url_ = urlBuilder_.ToString();
- request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute);
-
- PrepareRequest(client_, request_, url_);
-
- var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false);
- var disposeResponse_ = true;
- try
- {
- var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value);
- if (response_.Content != null && response_.Content.Headers != null)
- {
- foreach (var item_ in response_.Content.Headers)
- headers_[item_.Key] = item_.Value;
- }
-
- ProcessResponse(client_, response_);
-
- var status_ = (int)response_.StatusCode;
- if (status_ == 200)
- {
- var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false);
- if (objectResponse_.Object == null)
- {
- throw new DevilDaggersInfoApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null);
- }
- return objectResponse_.Object;
- }
- else
- if (status_ == 400)
- {
- var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false);
- if (objectResponse_.Object == null)
- {
- throw new DevilDaggersInfoApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null);
- }
- throw new DevilDaggersInfoApiException("A server side error occurred.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null);
- }
- else
- {
- var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false);
- throw new DevilDaggersInfoApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null);
- }
- }
- finally
- {
- if (disposeResponse_)
- response_.Dispose();
- }
- }
- }
- finally
- {
- if (disposeClient_)
- client_.Dispose();
- }
- }
-
- /// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
- /// A server side error occurred.
- public virtual async System.Threading.Tasks.Task> Mods_GetModsForDdaeAsync(string? authorFilter = null, string? nameFilter = null, bool? isHostedFilter = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
- {
- var urlBuilder_ = new System.Text.StringBuilder();
- urlBuilder_.Append("api/mods/ddae?");
- if (authorFilter != null)
- {
- urlBuilder_.Append(System.Uri.EscapeDataString("authorFilter") + "=").Append(System.Uri.EscapeDataString(ConvertToString(authorFilter, System.Globalization.CultureInfo.InvariantCulture))).Append("&");
- }
- if (nameFilter != null)
- {
- urlBuilder_.Append(System.Uri.EscapeDataString("nameFilter") + "=").Append(System.Uri.EscapeDataString(ConvertToString(nameFilter, System.Globalization.CultureInfo.InvariantCulture))).Append("&");
- }
- if (isHostedFilter != null)
- {
- urlBuilder_.Append(System.Uri.EscapeDataString("isHostedFilter") + "=").Append(System.Uri.EscapeDataString(ConvertToString(isHostedFilter, System.Globalization.CultureInfo.InvariantCulture))).Append("&");
- }
- urlBuilder_.Length--;
-
- var client_ = _httpClient;
- var disposeClient_ = false;
- try
- {
- using (var request_ = new System.Net.Http.HttpRequestMessage())
- {
- request_.Method = new System.Net.Http.HttpMethod("GET");
- request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json"));
-
- PrepareRequest(client_, request_, urlBuilder_);
-
- var url_ = urlBuilder_.ToString();
- request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute);
-
- PrepareRequest(client_, request_, url_);
-
- var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false);
- var disposeResponse_ = true;
- try
- {
- var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value);
- if (response_.Content != null && response_.Content.Headers != null)
- {
- foreach (var item_ in response_.Content.Headers)
- headers_[item_.Key] = item_.Value;
- }
-
- ProcessResponse(client_, response_);
-
- var status_ = (int)response_.StatusCode;
- if (status_ == 200)
- {
- var objectResponse_ = await ReadObjectResponseAsync>(response_, headers_, cancellationToken).ConfigureAwait(false);
- if (objectResponse_.Object == null)
- {
- throw new DevilDaggersInfoApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null);
- }
- return objectResponse_.Object;
- }
- else
- {
- var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false);
- throw new DevilDaggersInfoApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null);
- }
- }
- finally
- {
- if (disposeResponse_)
- response_.Dispose();
- }
- }
- }
- finally
- {
- if (disposeClient_)
- client_.Dispose();
- }
- }
-
- /// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
- /// A server side error occurred.
- public virtual async System.Threading.Tasks.Task Mods_GetModByIdAsync(int id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
- {
- if (id == null)
- throw new System.ArgumentNullException("id");
-
- var urlBuilder_ = new System.Text.StringBuilder();
- urlBuilder_.Append("api/mods/{id}");
- urlBuilder_.Replace("{id}", System.Uri.EscapeDataString(ConvertToString(id, System.Globalization.CultureInfo.InvariantCulture)));
-
- var client_ = _httpClient;
- var disposeClient_ = false;
- try
- {
- using (var request_ = new System.Net.Http.HttpRequestMessage())
- {
- request_.Method = new System.Net.Http.HttpMethod("GET");
- request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json"));
-
- PrepareRequest(client_, request_, urlBuilder_);
-
- var url_ = urlBuilder_.ToString();
- request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute);
-
- PrepareRequest(client_, request_, url_);
-
- var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false);
- var disposeResponse_ = true;
- try
- {
- var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value);
- if (response_.Content != null && response_.Content.Headers != null)
- {
- foreach (var item_ in response_.Content.Headers)
- headers_[item_.Key] = item_.Value;
- }
-
- ProcessResponse(client_, response_);
-
- var status_ = (int)response_.StatusCode;
- if (status_ == 200)
- {
- var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false);
- if (objectResponse_.Object == null)
- {
- throw new DevilDaggersInfoApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null);
- }
- return objectResponse_.Object;
- }
- else
- if (status_ == 400)
- {
- var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false);
- if (objectResponse_.Object == null)
- {
- throw new DevilDaggersInfoApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null);
- }
- throw new DevilDaggersInfoApiException("A server side error occurred.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null);
- }
- else
- if (status_ == 404)
- {
- var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false);
- if (objectResponse_.Object == null)
- {
- throw new DevilDaggersInfoApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null);
- }
- throw new DevilDaggersInfoApiException("A server side error occurred.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null);
- }
- else
- {
- var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false);
- throw new DevilDaggersInfoApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null);
- }
- }
- finally
- {
- if (disposeResponse_)
- response_.Dispose();
- }
- }
- }
- finally
- {
- if (disposeClient_)
- client_.Dispose();
- }
- }
-
- /// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
- /// A server side error occurred.
- public virtual async System.Threading.Tasks.Task Mods_GetTotalModDataAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
- {
- var urlBuilder_ = new System.Text.StringBuilder();
- urlBuilder_.Append("api/mods/total-data");
-
- var client_ = _httpClient;
- var disposeClient_ = false;
- try
- {
- using (var request_ = new System.Net.Http.HttpRequestMessage())
- {
- request_.Method = new System.Net.Http.HttpMethod("GET");
- request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json"));
-
- PrepareRequest(client_, request_, urlBuilder_);
-
- var url_ = urlBuilder_.ToString();
- request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute);
-
- PrepareRequest(client_, request_, url_);
-
- var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false);
- var disposeResponse_ = true;
- try
- {
- var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value);
- if (response_.Content != null && response_.Content.Headers != null)
- {
- foreach (var item_ in response_.Content.Headers)
- headers_[item_.Key] = item_.Value;
- }
-
- ProcessResponse(client_, response_);
-
- var status_ = (int)response_.StatusCode;
- if (status_ == 200)
- {
- var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false);
- if (objectResponse_.Object == null)
- {
- throw new DevilDaggersInfoApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null);
- }
- return objectResponse_.Object;
- }
- else
- {
- var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false);
- throw new DevilDaggersInfoApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null);
- }
- }
- finally
- {
- if (disposeResponse_)
- response_.Dispose();
- }
- }
- }
- finally
- {
- if (disposeClient_)
- client_.Dispose();
- }
- }
-
- /// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
- /// A server side error occurred.
- public virtual async System.Threading.Tasks.Task Mods_GetModFileAsync(string? modName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
- {
- var urlBuilder_ = new System.Text.StringBuilder();
- urlBuilder_.Append("api/mods/{modName}/file");
- urlBuilder_.Replace("{modName}", System.Uri.EscapeDataString(ConvertToString(modName, System.Globalization.CultureInfo.InvariantCulture)));
-
- var client_ = _httpClient;
- var disposeClient_ = false;
- try
- {
- using (var request_ = new System.Net.Http.HttpRequestMessage())
- {
- request_.Method = new System.Net.Http.HttpMethod("GET");
- request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/octet-stream"));
-
- PrepareRequest(client_, request_, urlBuilder_);
-
- var url_ = urlBuilder_.ToString();
- request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute);
-
- PrepareRequest(client_, request_, url_);
-
- var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false);
- var disposeResponse_ = true;
- try
- {
- var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value);
- if (response_.Content != null && response_.Content.Headers != null)
- {
- foreach (var item_ in response_.Content.Headers)
- headers_[item_.Key] = item_.Value;
- }
-
- ProcessResponse(client_, response_);
-
- var status_ = (int)response_.StatusCode;
- if (status_ == 200 || status_ == 206)
- {
- var responseStream_ = response_.Content == null ? System.IO.Stream.Null : await response_.Content.ReadAsStreamAsync().ConfigureAwait(false);
- var fileResponse_ = new FileResponse(status_, headers_, responseStream_, null, response_);
- disposeClient_ = false; disposeResponse_ = false; // response and client are disposed by FileResponse
- return fileResponse_;
- }
- else
- if (status_ == 400)
- {
- var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false);
- if (objectResponse_.Object == null)
- {
- throw new DevilDaggersInfoApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null);
- }
- throw new DevilDaggersInfoApiException("A server side error occurred.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null);
- }
- else
- if (status_ == 404)
- {
- var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false);
- if (objectResponse_.Object == null)
- {
- throw new DevilDaggersInfoApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null);
- }
- throw new DevilDaggersInfoApiException("A server side error occurred.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null);
- }
- else
- {
- var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false);
- throw new DevilDaggersInfoApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null);
- }
- }
- finally
- {
- if (disposeResponse_)
- response_.Dispose();
- }
- }
- }
- finally
- {
- if (disposeClient_)
- client_.Dispose();
- }
- }
-
- /// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
- /// A server side error occurred.
- public virtual async System.Threading.Tasks.Task> Mods_GetModsByAuthorIdAsync(int? playerId = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
- {
- var urlBuilder_ = new System.Text.StringBuilder();
- urlBuilder_.Append("api/mods/by-author?");
- if (playerId != null)
- {
- urlBuilder_.Append(System.Uri.EscapeDataString("playerId") + "=").Append(System.Uri.EscapeDataString(ConvertToString(playerId, System.Globalization.CultureInfo.InvariantCulture))).Append("&");
- }
- urlBuilder_.Length--;
-
- var client_ = _httpClient;
- var disposeClient_ = false;
- try
- {
- using (var request_ = new System.Net.Http.HttpRequestMessage())
- {
- request_.Method = new System.Net.Http.HttpMethod("GET");
- request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json"));
-
- PrepareRequest(client_, request_, urlBuilder_);
-
- var url_ = urlBuilder_.ToString();
- request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute);
-
- PrepareRequest(client_, request_, url_);
-
- var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false);
- var disposeResponse_ = true;
- try
- {
- var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value);
- if (response_.Content != null && response_.Content.Headers != null)
- {
- foreach (var item_ in response_.Content.Headers)
- headers_[item_.Key] = item_.Value;
- }
-
- ProcessResponse(client_, response_);
-
- var status_ = (int)response_.StatusCode;
- if (status_ == 200)
- {
- var objectResponse_ = await ReadObjectResponseAsync>(response_, headers_, cancellationToken).ConfigureAwait(false);
- if (objectResponse_.Object == null)
- {
- throw new DevilDaggersInfoApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null);
- }
- return objectResponse_.Object;
- }
- else
- {
- var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false);
- throw new DevilDaggersInfoApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null);
- }
- }
- finally
- {
- if (disposeResponse_)
- response_.Dispose();
- }
- }
- }
- finally
- {
- if (disposeClient_)
- client_.Dispose();
- }
- }
-
- /// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
- /// A server side error occurred.
- public virtual async System.Threading.Tasks.Task ModScreenshots_GetScreenshotByFilePathAsync(string? modName = null, string? fileName = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
- {
- var urlBuilder_ = new System.Text.StringBuilder();
- urlBuilder_.Append("api/mod-screenshots?");
- if (modName != null)
- {
- urlBuilder_.Append(System.Uri.EscapeDataString("modName") + "=").Append(System.Uri.EscapeDataString(ConvertToString(modName, System.Globalization.CultureInfo.InvariantCulture))).Append("&");
- }
- if (fileName != null)
- {
- urlBuilder_.Append(System.Uri.EscapeDataString("fileName") + "=").Append(System.Uri.EscapeDataString(ConvertToString(fileName, System.Globalization.CultureInfo.InvariantCulture))).Append("&");
- }
- urlBuilder_.Length--;
-
- var client_ = _httpClient;
- var disposeClient_ = false;
- try
- {
- using (var request_ = new System.Net.Http.HttpRequestMessage())
- {
- request_.Method = new System.Net.Http.HttpMethod("GET");
- request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/octet-stream"));
-
- PrepareRequest(client_, request_, urlBuilder_);
-
- var url_ = urlBuilder_.ToString();
- request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute);
-
- PrepareRequest(client_, request_, url_);
-
- var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false);
- var disposeResponse_ = true;
- try
- {
- var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value);
- if (response_.Content != null && response_.Content.Headers != null)
- {
- foreach (var item_ in response_.Content.Headers)
- headers_[item_.Key] = item_.Value;
- }
-
- ProcessResponse(client_, response_);
-
- var status_ = (int)response_.StatusCode;
- if (status_ == 200 || status_ == 206)
- {
- var responseStream_ = response_.Content == null ? System.IO.Stream.Null : await response_.Content.ReadAsStreamAsync().ConfigureAwait(false);
- var fileResponse_ = new FileResponse(status_, headers_, responseStream_, null, response_);
- disposeClient_ = false; disposeResponse_ = false; // response and client are disposed by FileResponse
- return fileResponse_;
- }
- else
- if (status_ == 400)
- {
- var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false);
- if (objectResponse_.Object == null)
- {
- throw new DevilDaggersInfoApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null);
- }
- throw new DevilDaggersInfoApiException("A server side error occurred.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null);
- }
- else
- if (status_ == 404)
- {
- var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false);
- if (objectResponse_.Object == null)
- {
- throw new DevilDaggersInfoApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null);
- }
- throw new DevilDaggersInfoApiException("A server side error occurred.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null);
- }
- else
- {
- var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false);
- throw new DevilDaggersInfoApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null);
- }
- }
- finally
- {
- if (disposeResponse_)
- response_.Dispose();
- }
- }
- }
- finally
- {
- if (disposeClient_)
- client_.Dispose();
- }
- }
-
- /// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
- /// A server side error occurred.
- public virtual async System.Threading.Tasks.Task> Players_GetPlayersForLeaderboardAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
- {
- var urlBuilder_ = new System.Text.StringBuilder();
- urlBuilder_.Append("api/players/leaderboard");
-
- var client_ = _httpClient;
- var disposeClient_ = false;
- try
- {
- using (var request_ = new System.Net.Http.HttpRequestMessage())
- {
- request_.Method = new System.Net.Http.HttpMethod("GET");
- request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json"));
-
- PrepareRequest(client_, request_, urlBuilder_);
-
- var url_ = urlBuilder_.ToString();
- request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute);
-
- PrepareRequest(client_, request_, url_);
-
- var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false);
- var disposeResponse_ = true;
- try
- {
- var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value);
- if (response_.Content != null && response_.Content.Headers != null)
- {
- foreach (var item_ in response_.Content.Headers)
- headers_[item_.Key] = item_.Value;
- }
-
- ProcessResponse(client_, response_);
-
- var status_ = (int)response_.StatusCode;
- if (status_ == 200)
- {
- var objectResponse_ = await ReadObjectResponseAsync>(response_, headers_, cancellationToken).ConfigureAwait(false);
- if (objectResponse_.Object == null)
- {
- throw new DevilDaggersInfoApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null);
- }
- return objectResponse_.Object;
- }
- else
- {
- var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false);
- throw new DevilDaggersInfoApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null);
- }
- }
- finally
- {
- if (disposeResponse_)
- response_.Dispose();
- }
- }
- }
- finally
- {
- if (disposeClient_)
- client_.Dispose();
- }
- }
-
- /// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
- /// A server side error occurred.
- public virtual async System.Threading.Tasks.Task> Players_GetCommonNamesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
- {
- var urlBuilder_ = new System.Text.StringBuilder();
- urlBuilder_.Append("api/players/common-names");
-
- var client_ = _httpClient;
- var disposeClient_ = false;
- try
- {
- using (var request_ = new System.Net.Http.HttpRequestMessage())
- {
- request_.Method = new System.Net.Http.HttpMethod("GET");
- request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json"));
-
- PrepareRequest(client_, request_, urlBuilder_);
-
- var url_ = urlBuilder_.ToString();
- request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute);
-
- PrepareRequest(client_, request_, url_);
-
- var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false);
- var disposeResponse_ = true;
- try
- {
- var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value);
- if (response_.Content != null && response_.Content.Headers != null)
- {
- foreach (var item_ in response_.Content.Headers)
- headers_[item_.Key] = item_.Value;
- }
-
- ProcessResponse(client_, response_);
-
- var status_ = (int)response_.StatusCode;
- if (status_ == 200)
- {
- var objectResponse_ = await ReadObjectResponseAsync>(response_, headers_, cancellationToken).ConfigureAwait(false);
- if (objectResponse_.Object == null)
- {
- throw new DevilDaggersInfoApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null);
- }
- return objectResponse_.Object;
- }
- else
- {
- var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false);
- throw new DevilDaggersInfoApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null);
- }
- }
- finally
- {
- if (disposeResponse_)
- response_.Dispose();
- }
- }
- }
- finally
- {
- if (disposeClient_)
- client_.Dispose();
- }
- }
-
- /// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
- /// A server side error occurred.
- public virtual async System.Threading.Tasks.Task> Players_GetPlayersForSettingsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
- {
- var urlBuilder_ = new System.Text.StringBuilder();
- urlBuilder_.Append("api/players/settings");
-
- var client_ = _httpClient;
- var disposeClient_ = false;
- try
- {
- using (var request_ = new System.Net.Http.HttpRequestMessage())
- {
- request_.Method = new System.Net.Http.HttpMethod("GET");
- request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json"));
-
- PrepareRequest(client_, request_, urlBuilder_);
-
- var url_ = urlBuilder_.ToString();
- request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute);
-
- PrepareRequest(client_, request_, url_);
-
- var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false);
- var disposeResponse_ = true;
- try
- {
- var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value);
- if (response_.Content != null && response_.Content.Headers != null)
- {
- foreach (var item_ in response_.Content.Headers)
- headers_[item_.Key] = item_.Value;
- }
-
- ProcessResponse(client_, response_);
-
- var status_ = (int)response_.StatusCode;
- if (status_ == 200)
- {
- var objectResponse_ = await ReadObjectResponseAsync>(response_, headers_, cancellationToken).ConfigureAwait(false);
- if (objectResponse_.Object == null)
- {
- throw new DevilDaggersInfoApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null);
- }
- return objectResponse_.Object;
- }
- else
- {
- var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false);
- throw new DevilDaggersInfoApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null);
- }
- }
- finally
- {
- if (disposeResponse_)
- response_.Dispose();
- }
- }
- }
- finally
- {
- if (disposeClient_)
- client_.Dispose();
- }
- }
-
- /// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
- /// A server side error occurred.
- public virtual async System.Threading.Tasks.Task Players_GetPlayerByIdAsync(int id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
- {
- if (id == null)
- throw new System.ArgumentNullException("id");
-
- var urlBuilder_ = new System.Text.StringBuilder();
- urlBuilder_.Append("api/players/{id}");
- urlBuilder_.Replace("{id}", System.Uri.EscapeDataString(ConvertToString(id, System.Globalization.CultureInfo.InvariantCulture)));
-
- var client_ = _httpClient;
- var disposeClient_ = false;
- try
- {
- using (var request_ = new System.Net.Http.HttpRequestMessage())
- {
- request_.Method = new System.Net.Http.HttpMethod("GET");
- request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json"));
-
- PrepareRequest(client_, request_, urlBuilder_);
-
- var url_ = urlBuilder_.ToString();
- request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute);
-
- PrepareRequest(client_, request_, url_);
-
- var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false);
- var disposeResponse_ = true;
- try
- {
- var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value);
- if (response_.Content != null && response_.Content.Headers != null)
- {
- foreach (var item_ in response_.Content.Headers)
- headers_[item_.Key] = item_.Value;
- }
-
- ProcessResponse(client_, response_);
-
- var status_ = (int)response_.StatusCode;
- if (status_ == 200)
- {
- var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false);
- if (objectResponse_.Object == null)
- {
- throw new DevilDaggersInfoApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null);
- }
- return objectResponse_.Object;
- }
- else
- if (status_ == 400)
- {
- var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false);
- if (objectResponse_.Object == null)
- {
- throw new DevilDaggersInfoApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null);
- }
- throw new DevilDaggersInfoApiException("A server side error occurred.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null);
- }
- else
- if (status_ == 404)
- {
- var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false);
- if (objectResponse_.Object == null)
- {
- throw new DevilDaggersInfoApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null);
- }
- throw new DevilDaggersInfoApiException("A server side error occurred.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null);
- }
- else
- {
- var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false);
- throw new DevilDaggersInfoApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null);
- }
- }
- finally
- {
- if (disposeResponse_)
- response_.Dispose();
- }
- }
- }
- finally
- {
- if (disposeClient_)
- client_.Dispose();
- }
- }
-
- /// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
- /// A server side error occurred.
- public virtual async System.Threading.Tasks.Task Players_GetPlayerFlagByIdAsync(int id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
- {
- if (id == null)
- throw new System.ArgumentNullException("id");
-
- var urlBuilder_ = new System.Text.StringBuilder();
- urlBuilder_.Append("api/players/{id}/flag");
- urlBuilder_.Replace("{id}", System.Uri.EscapeDataString(ConvertToString(id, System.Globalization.CultureInfo.InvariantCulture)));
-
- var client_ = _httpClient;
- var disposeClient_ = false;
- try
- {
- using (var request_ = new System.Net.Http.HttpRequestMessage())
- {
- request_.Method = new System.Net.Http.HttpMethod("GET");
- request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json"));
-
- PrepareRequest(client_, request_, urlBuilder_);
-
- var url_ = urlBuilder_.ToString();
- request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute);
-
- PrepareRequest(client_, request_, url_);
-
- var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false);
- var disposeResponse_ = true;
- try
- {
- var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value);
- if (response_.Content != null && response_.Content.Headers != null)
- {
- foreach (var item_ in response_.Content.Headers)
- headers_[item_.Key] = item_.Value;
- }
-
- ProcessResponse(client_, response_);
-
- var status_ = (int)response_.StatusCode;
- if (status_ == 200)
- {
- var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false);
- if (objectResponse_.Object == null)
- {
- throw new DevilDaggersInfoApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null);
- }
- return objectResponse_.Object;
- }
- else
- if (status_ == 400)
- {
- var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false);
- if (objectResponse_.Object == null)
- {
- throw new DevilDaggersInfoApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null);
- }
- throw new DevilDaggersInfoApiException("A server side error occurred.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null);
- }
- else
- {
- var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false);
- throw new DevilDaggersInfoApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null);
- }
- }
- finally
- {
- if (disposeResponse_)
- response_.Dispose();
- }
- }
- }
- finally
- {
- if (disposeClient_)
- client_.Dispose();
- }
- }
-
- /// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
- /// A server side error occurred.
- public virtual async System.Threading.Tasks.Task Players_GetPlayerHistoryByIdAsync(int id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
- {
- if (id == null)
- throw new System.ArgumentNullException("id");
-
- var urlBuilder_ = new System.Text.StringBuilder();
- urlBuilder_.Append("api/players/{id}/history");
- urlBuilder_.Replace("{id}", System.Uri.EscapeDataString(ConvertToString(id, System.Globalization.CultureInfo.InvariantCulture)));
-
- var client_ = _httpClient;
- var disposeClient_ = false;
- try
- {
- using (var request_ = new System.Net.Http.HttpRequestMessage())
- {
- request_.Method = new System.Net.Http.HttpMethod("GET");
- request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json"));
-
- PrepareRequest(client_, request_, urlBuilder_);
-
- var url_ = urlBuilder_.ToString();
- request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute);
-
- PrepareRequest(client_, request_, url_);
-
- var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false);
- var disposeResponse_ = true;
- try
- {
- var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value);
- if (response_.Content != null && response_.Content.Headers != null)
- {
- foreach (var item_ in response_.Content.Headers)
- headers_[item_.Key] = item_.Value;
- }
-
- ProcessResponse(client_, response_);
-
- var status_ = (int)response_.StatusCode;
- if (status_ == 200)
- {
- var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false);
- if (objectResponse_.Object == null)
- {
- throw new DevilDaggersInfoApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null);
- }
- return objectResponse_.Object;
- }
- else
- if (status_ == 400)
- {
- var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false);
- if (objectResponse_.Object == null)
- {
- throw new DevilDaggersInfoApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null);
- }
- throw new DevilDaggersInfoApiException("A server side error occurred.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null);
- }
- else
- {
- var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false);
- throw new DevilDaggersInfoApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null);
- }
- }
- finally
- {
- if (disposeResponse_)
- response_.Dispose();
- }
- }
- }
- finally
- {
- if (disposeClient_)
- client_.Dispose();
- }
- }
-
- /// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
- /// A server side error occurred.
- public virtual async System.Threading.Tasks.Task> Players_GetCustomLeaderboardStatisticsByPlayerIdAsync(int id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
- {
- if (id == null)
- throw new System.ArgumentNullException("id");
-
- var urlBuilder_ = new System.Text.StringBuilder();
- urlBuilder_.Append("api/players/{id}/custom-leaderboard-statistics");
- urlBuilder_.Replace("{id}", System.Uri.EscapeDataString(ConvertToString(id, System.Globalization.CultureInfo.InvariantCulture)));
-
- var client_ = _httpClient;
- var disposeClient_ = false;
- try
- {
- using (var request_ = new System.Net.Http.HttpRequestMessage())
- {
- request_.Method = new System.Net.Http.HttpMethod("GET");
- request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json"));
-
- PrepareRequest(client_, request_, urlBuilder_);
-
- var url_ = urlBuilder_.ToString();
- request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute);
-
- PrepareRequest(client_, request_, url_);
-
- var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false);
- var disposeResponse_ = true;
- try
- {
- var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value);
- if (response_.Content != null && response_.Content.Headers != null)
- {
- foreach (var item_ in response_.Content.Headers)
- headers_[item_.Key] = item_.Value;
- }
-
- ProcessResponse(client_, response_);
-
- var status_ = (int)response_.StatusCode;
- if (status_ == 200)
- {
- var objectResponse_ = await ReadObjectResponseAsync>(response_, headers_, cancellationToken).ConfigureAwait(false);
- if (objectResponse_.Object == null)
- {
- throw new DevilDaggersInfoApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null);
- }
- return objectResponse_.Object;
- }
- else
- {
- var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false);
- throw new DevilDaggersInfoApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null);
- }
- }
- finally
- {
- if (disposeResponse_)
- response_.Dispose();
- }
- }
- }
- finally
- {
- if (disposeClient_)
- client_.Dispose();
- }
- }
-
- /// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
- /// A server side error occurred.
- public virtual async System.Threading.Tasks.Task Players_GetProfileByPlayerIdAsync(int id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
- {
- if (id == null)
- throw new System.ArgumentNullException("id");
-
- var urlBuilder_ = new System.Text.StringBuilder();
- urlBuilder_.Append("api/players/{id}/profile");
- urlBuilder_.Replace("{id}", System.Uri.EscapeDataString(ConvertToString(id, System.Globalization.CultureInfo.InvariantCulture)));
-
- var client_ = _httpClient;
- var disposeClient_ = false;
- try
- {
- using (var request_ = new System.Net.Http.HttpRequestMessage())
- {
- request_.Method = new System.Net.Http.HttpMethod("GET");
- request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json"));
-
- PrepareRequest(client_, request_, urlBuilder_);
-
- var url_ = urlBuilder_.ToString();
- request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute);
-
- PrepareRequest(client_, request_, url_);
-
- var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false);
- var disposeResponse_ = true;
- try
- {
- var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value);
- if (response_.Content != null && response_.Content.Headers != null)
- {
- foreach (var item_ in response_.Content.Headers)
- headers_[item_.Key] = item_.Value;
- }
-
- ProcessResponse(client_, response_);
-
- var status_ = (int)response_.StatusCode;
- if (status_ == 200)
- {
- var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false);
- if (objectResponse_.Object == null)
- {
- throw new DevilDaggersInfoApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null);
- }
- return objectResponse_.Object;
- }
- else
- if (status_ == 400)
- {
- var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false);
- if (objectResponse_.Object == null)
- {
- throw new DevilDaggersInfoApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null);
- }
- throw new DevilDaggersInfoApiException("A server side error occurred.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null);
- }
- else
- if (status_ == 401)
- {
- var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false);
- if (objectResponse_.Object == null)
- {
- throw new DevilDaggersInfoApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null);
- }
- throw new DevilDaggersInfoApiException("A server side error occurred.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null);
- }
- else
- if (status_ == 403)
- {
- var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false);
- if (objectResponse_.Object == null)
- {
- throw new DevilDaggersInfoApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null);
- }
- throw new DevilDaggersInfoApiException("A server side error occurred.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null);
- }
- else
- if (status_ == 404)
- {
- var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false);
- if (objectResponse_.Object == null)
- {
- throw new DevilDaggersInfoApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null);
- }
- throw new DevilDaggersInfoApiException("A server side error occurred.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null);
- }
- else
- {
- var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false);
- throw new DevilDaggersInfoApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null);
- }
- }
- finally
- {
- if (disposeResponse_)
- response_.Dispose();
- }
- }
- }
- finally
- {
- if (disposeClient_)
- client_.Dispose();
- }
- }
-
- /// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
- /// A server side error occurred.
- public virtual async System.Threading.Tasks.Task Players_UpdateProfileByPlayerIdAsync(int id, EditPlayerProfile editPlayerProfile, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
- {
- if (id == null)
- throw new System.ArgumentNullException("id");
-
- if (editPlayerProfile == null)
- throw new System.ArgumentNullException("editPlayerProfile");
-
- var urlBuilder_ = new System.Text.StringBuilder();
- urlBuilder_.Append("api/players/{id}/profile");
- urlBuilder_.Replace("{id}", System.Uri.EscapeDataString(ConvertToString(id, System.Globalization.CultureInfo.InvariantCulture)));
-
- var client_ = _httpClient;
- var disposeClient_ = false;
- try
- {
- using (var request_ = new System.Net.Http.HttpRequestMessage())
- {
- var content_ = new System.Net.Http.StringContent(Newtonsoft.Json.JsonConvert.SerializeObject(editPlayerProfile, _settings.Value));
- content_.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json");
- request_.Content = content_;
- request_.Method = new System.Net.Http.HttpMethod("PUT");
-
- PrepareRequest(client_, request_, urlBuilder_);
-
- var url_ = urlBuilder_.ToString();
- request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute);
-
- PrepareRequest(client_, request_, url_);
-
- var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false);
- var disposeResponse_ = true;
- try
- {
- var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value);
- if (response_.Content != null && response_.Content.Headers != null)
- {
- foreach (var item_ in response_.Content.Headers)
- headers_[item_.Key] = item_.Value;
- }
-
- ProcessResponse(client_, response_);
-
- var status_ = (int)response_.StatusCode;
- if (status_ == 200)
- {
- return;
- }
- else
- if (status_ == 400)
- {
- var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false);
- if (objectResponse_.Object == null)
- {
- throw new DevilDaggersInfoApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null);
- }
- throw new DevilDaggersInfoApiException("A server side error occurred.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null);
- }
- else
- if (status_ == 401)
- {
- var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false);
- if (objectResponse_.Object == null)
- {
- throw new DevilDaggersInfoApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null);
- }
- throw new DevilDaggersInfoApiException("A server side error occurred.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null);
- }
- else
- if (status_ == 403)
- {
- var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false);
- if (objectResponse_.Object == null)
- {
- throw new DevilDaggersInfoApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null);
- }
- throw new DevilDaggersInfoApiException("A server side error occurred.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null);
- }
- else
- if (status_ == 404)
- {
- var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false);
- if (objectResponse_.Object == null)
- {
- throw new DevilDaggersInfoApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null);
- }
- throw new DevilDaggersInfoApiException("A server side error occurred.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null);
- }
- else
- {
- var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false);
- throw new DevilDaggersInfoApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null);
- }
- }
- finally
- {
- if (disposeResponse_)
- response_.Dispose();
- }
- }
- }
- finally
- {
- if (disposeClient_)
- client_.Dispose();
- }
- }
-
- /// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
- /// A server side error occurred.
- public virtual async System.Threading.Tasks.Task ProcessMemory_GetMarkerAsync(SupportedOperatingSystem? operatingSystem = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
- {
- var urlBuilder_ = new System.Text.StringBuilder();
- urlBuilder_.Append("api/process-memory/marker?");
- if (operatingSystem != null)
- {
- urlBuilder_.Append(System.Uri.EscapeDataString("operatingSystem") + "=").Append(System.Uri.EscapeDataString(ConvertToString(operatingSystem, System.Globalization.CultureInfo.InvariantCulture))).Append("&");
- }
- urlBuilder_.Length--;
-
- var client_ = _httpClient;
- var disposeClient_ = false;
- try
- {
- using (var request_ = new System.Net.Http.HttpRequestMessage())
- {
- request_.Method = new System.Net.Http.HttpMethod("GET");
- request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json"));
-
- PrepareRequest(client_, request_, urlBuilder_);
-
- var url_ = urlBuilder_.ToString();
- request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute);
-
- PrepareRequest(client_, request_, url_);
-
- var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false);
- var disposeResponse_ = true;
- try
- {
- var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value);
- if (response_.Content != null && response_.Content.Headers != null)
- {
- foreach (var item_ in response_.Content.Headers)
- headers_[item_.Key] = item_.Value;
- }
-
- ProcessResponse(client_, response_);
-
- var status_ = (int)response_.StatusCode;
- if (status_ == 200)
- {
- var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false);
- if (objectResponse_.Object == null)
- {
- throw new DevilDaggersInfoApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null);
- }
- return objectResponse_.Object;
- }
- else
- if (status_ == 400)
- {
- var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false);
- if (objectResponse_.Object == null)
- {
- throw new DevilDaggersInfoApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null);
- }
- throw new DevilDaggersInfoApiException("A server side error occurred.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null);
- }
- else
- {
- var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false);
- throw new DevilDaggersInfoApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null);
- }
- }
- finally
- {
- if (disposeResponse_)
- response_.Dispose();
- }
- }
- }
- finally
- {
- if (disposeClient_)
- client_.Dispose();
- }
- }
-
- /// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
- /// A server side error occurred.
- public virtual async System.Threading.Tasks.Task Spawnsets_GetSpawnsetsAsync(bool? practiceOnly = null, bool? withCustomLeaderboardOnly = null, string? spawnsetFilter = null, string? authorFilter = null, int? pageIndex = null, int? pageSize = null, SpawnsetSorting? sortBy = null, bool? ascending = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
- {
- var urlBuilder_ = new System.Text.StringBuilder();
- urlBuilder_.Append("api/spawnsets?");
- if (practiceOnly != null)
- {
- urlBuilder_.Append(System.Uri.EscapeDataString("practiceOnly") + "=").Append(System.Uri.EscapeDataString(ConvertToString(practiceOnly, System.Globalization.CultureInfo.InvariantCulture))).Append("&");
- }
- if (withCustomLeaderboardOnly != null)
- {
- urlBuilder_.Append(System.Uri.EscapeDataString("withCustomLeaderboardOnly") + "=").Append(System.Uri.EscapeDataString(ConvertToString(withCustomLeaderboardOnly, System.Globalization.CultureInfo.InvariantCulture))).Append("&");
- }
- if (spawnsetFilter != null)
- {
- urlBuilder_.Append(System.Uri.EscapeDataString("spawnsetFilter") + "=").Append(System.Uri.EscapeDataString(ConvertToString(spawnsetFilter, System.Globalization.CultureInfo.InvariantCulture))).Append("&");
- }
- if (authorFilter != null)
- {
- urlBuilder_.Append(System.Uri.EscapeDataString("authorFilter") + "=").Append(System.Uri.EscapeDataString(ConvertToString(authorFilter, System.Globalization.CultureInfo.InvariantCulture))).Append("&");
- }
- if (pageIndex != null)
- {
- urlBuilder_.Append(System.Uri.EscapeDataString("pageIndex") + "=").Append(System.Uri.EscapeDataString(ConvertToString(pageIndex, System.Globalization.CultureInfo.InvariantCulture))).Append("&");
- }
- if (pageSize != null)
- {
- urlBuilder_.Append(System.Uri.EscapeDataString("pageSize") + "=").Append(System.Uri.EscapeDataString(ConvertToString(pageSize, System.Globalization.CultureInfo.InvariantCulture))).Append("&");
- }
- if (sortBy != null)
- {
- urlBuilder_.Append(System.Uri.EscapeDataString("sortBy") + "=").Append(System.Uri.EscapeDataString(ConvertToString(sortBy, System.Globalization.CultureInfo.InvariantCulture))).Append("&");
- }
- if (ascending != null)
- {
- urlBuilder_.Append(System.Uri.EscapeDataString("ascending") + "=").Append(System.Uri.EscapeDataString(ConvertToString(ascending, System.Globalization.CultureInfo.InvariantCulture))).Append("&");
- }
- urlBuilder_.Length--;
-
- var client_ = _httpClient;
- var disposeClient_ = false;
- try
- {
- using (var request_ = new System.Net.Http.HttpRequestMessage())
- {
- request_.Method = new System.Net.Http.HttpMethod("GET");
- request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json"));
-
- PrepareRequest(client_, request_, urlBuilder_);
-
- var url_ = urlBuilder_.ToString();
- request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute);
-
- PrepareRequest(client_, request_, url_);
-
- var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false);
- var disposeResponse_ = true;
- try
- {
- var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value);
- if (response_.Content != null && response_.Content.Headers != null)
- {
- foreach (var item_ in response_.Content.Headers)
- headers_[item_.Key] = item_.Value;
- }
-
- ProcessResponse(client_, response_);
-
- var status_ = (int)response_.StatusCode;
- if (status_ == 200)
- {
- var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false);
- if (objectResponse_.Object == null)
- {
- throw new DevilDaggersInfoApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null);
- }
- return objectResponse_.Object;
- }
- else
- if (status_ == 400)
- {
- var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false);
- if (objectResponse_.Object == null)
- {
- throw new DevilDaggersInfoApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null);
- }
- throw new DevilDaggersInfoApiException("A server side error occurred.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null);
- }
- else
- {
- var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false);
- throw new DevilDaggersInfoApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null);
- }
- }
- finally
- {
- if (disposeResponse_)
- response_.Dispose();
- }
- }
- }
- finally
- {
- if (disposeClient_)
- client_.Dispose();
- }
- }
-
- /// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
- /// A server side error occurred.
- public virtual async System.Threading.Tasks.Task> Spawnsets_GetSpawnsetsForDdseAsync(string? authorFilter = null, string? nameFilter = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
- {
- var urlBuilder_ = new System.Text.StringBuilder();
- urlBuilder_.Append("api/spawnsets/ddse?");
- if (authorFilter != null)
- {
- urlBuilder_.Append(System.Uri.EscapeDataString("authorFilter") + "=").Append(System.Uri.EscapeDataString(ConvertToString(authorFilter, System.Globalization.CultureInfo.InvariantCulture))).Append("&");
- }
- if (nameFilter != null)
- {
- urlBuilder_.Append(System.Uri.EscapeDataString("nameFilter") + "=").Append(System.Uri.EscapeDataString(ConvertToString(nameFilter, System.Globalization.CultureInfo.InvariantCulture))).Append("&");
- }
- urlBuilder_.Length--;
-
- var client_ = _httpClient;
- var disposeClient_ = false;
- try
- {
- using (var request_ = new System.Net.Http.HttpRequestMessage())
- {
- request_.Method = new System.Net.Http.HttpMethod("GET");
- request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json"));
-
- PrepareRequest(client_, request_, urlBuilder_);
-
- var url_ = urlBuilder_.ToString();
- request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute);
-
- PrepareRequest(client_, request_, url_);
-
- var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false);
- var disposeResponse_ = true;
- try
- {
- var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value);
- if (response_.Content != null && response_.Content.Headers != null)
- {
- foreach (var item_ in response_.Content.Headers)
- headers_[item_.Key] = item_.Value;
- }
-
- ProcessResponse(client_, response_);
-
- var status_ = (int)response_.StatusCode;
- if (status_ == 200)
- {
- var objectResponse_ = await ReadObjectResponseAsync>(response_, headers_, cancellationToken).ConfigureAwait(false);
- if (objectResponse_.Object == null)
- {
- throw new DevilDaggersInfoApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null);
- }
- return objectResponse_.Object;
- }
- else
- {
- var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false);
- throw new DevilDaggersInfoApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null);
- }
- }
- finally
- {
- if (disposeResponse_)
- response_.Dispose();
- }
- }
- }
- finally
- {
- if (disposeClient_)
- client_.Dispose();
- }
- }
-
- /// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
- /// A server side error occurred.
- public virtual async System.Threading.Tasks.Task Spawnsets_GetSpawnsetByHashAsync(byte[]? hash = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
- {
- var urlBuilder_ = new System.Text.StringBuilder();
- urlBuilder_.Append("api/spawnsets/by-hash?");
- if (hash != null)
- {
- urlBuilder_.Append(System.Uri.EscapeDataString("hash") + "=").Append(System.Uri.EscapeDataString(ConvertToString(hash, System.Globalization.CultureInfo.InvariantCulture))).Append("&");
- }
- urlBuilder_.Length--;
-
- var client_ = _httpClient;
- var disposeClient_ = false;
- try
- {
- using (var request_ = new System.Net.Http.HttpRequestMessage())
- {
- request_.Method = new System.Net.Http.HttpMethod("GET");
- request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json"));
-
- PrepareRequest(client_, request_, urlBuilder_);
-
- var url_ = urlBuilder_.ToString();
- request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute);
-
- PrepareRequest(client_, request_, url_);
-
- var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false);
- var disposeResponse_ = true;
- try
- {
- var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value);
- if (response_.Content != null && response_.Content.Headers != null)
- {
- foreach (var item_ in response_.Content.Headers)
- headers_[item_.Key] = item_.Value;
- }
-
- ProcessResponse(client_, response_);
-
- var status_ = (int)response_.StatusCode;
- if (status_ == 200)
- {
- var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false);
- if (objectResponse_.Object == null)
- {
- throw new DevilDaggersInfoApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null);
- }
- return objectResponse_.Object;
- }
- else
- if (status_ == 404)
- {
- var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false);
- if (objectResponse_.Object == null)
- {
- throw new DevilDaggersInfoApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null);
- }
- throw new DevilDaggersInfoApiException("A server side error occurred.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null);
- }
- else
- {
- var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false);
- throw new DevilDaggersInfoApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null);
- }
- }
- finally
- {
- if (disposeResponse_)
- response_.Dispose();
- }
- }
- }
- finally
- {
- if (disposeClient_)
- client_.Dispose();
- }
- }
-
- /// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
- /// A server side error occurred.
- public virtual async System.Threading.Tasks.Task Spawnsets_GetSpawnsetNameByHashAsync(byte[]? hash = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
- {
- var urlBuilder_ = new System.Text.StringBuilder();
- urlBuilder_.Append("api/spawnsets/name-by-hash?");
- if (hash != null)
- {
- urlBuilder_.Append(System.Uri.EscapeDataString("hash") + "=").Append(System.Uri.EscapeDataString(ConvertToString(hash, System.Globalization.CultureInfo.InvariantCulture))).Append("&");
- }
- urlBuilder_.Length--;
-
- var client_ = _httpClient;
- var disposeClient_ = false;
- try
- {
- using (var request_ = new System.Net.Http.HttpRequestMessage())
- {
- request_.Method = new System.Net.Http.HttpMethod("GET");
- request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json"));
-
- PrepareRequest(client_, request_, urlBuilder_);
-
- var url_ = urlBuilder_.ToString();
- request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute);
-
- PrepareRequest(client_, request_, url_);
-
- var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false);
- var disposeResponse_ = true;
- try
- {
- var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value);
- if (response_.Content != null && response_.Content.Headers != null)
- {
- foreach (var item_ in response_.Content.Headers)
- headers_[item_.Key] = item_.Value;
- }
-
- ProcessResponse(client_, response_);
-
- var status_ = (int)response_.StatusCode;
- if (status_ == 200)
- {
- var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false);
- if (objectResponse_.Object == null)
- {
- throw new DevilDaggersInfoApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null);
- }
- return objectResponse_.Object;
- }
- else
- if (status_ == 404)
- {
- var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false);
- if (objectResponse_.Object == null)
- {
- throw new DevilDaggersInfoApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null);
- }
- throw new DevilDaggersInfoApiException("A server side error occurred.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null);
- }
- else
- {
- var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false);
- throw new DevilDaggersInfoApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null);
- }
- }
- finally
- {
- if (disposeResponse_)
- response_.Dispose();
- }
- }
- }
- finally
- {
- if (disposeClient_)
- client_.Dispose();
- }
- }
-
- /// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
- /// A server side error occurred.
- public virtual async System.Threading.Tasks.Task Spawnsets_GetSpawnsetHashAsync(string? fileName = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
- {
- var urlBuilder_ = new System.Text.StringBuilder();
- urlBuilder_.Append("api/spawnsets/hash?");
- if (fileName != null)
- {
- urlBuilder_.Append(System.Uri.EscapeDataString("fileName") + "=").Append(System.Uri.EscapeDataString(ConvertToString(fileName, System.Globalization.CultureInfo.InvariantCulture))).Append("&");
- }
- urlBuilder_.Length--;
-
- var client_ = _httpClient;
- var disposeClient_ = false;
- try
- {
- using (var request_ = new System.Net.Http.HttpRequestMessage())
- {
- request_.Method = new System.Net.Http.HttpMethod("GET");
- request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json"));
-
- PrepareRequest(client_, request_, urlBuilder_);
-
- var url_ = urlBuilder_.ToString();
- request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute);
-
- PrepareRequest(client_, request_, url_);
-
- var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false);
- var disposeResponse_ = true;
- try
- {
- var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value);
- if (response_.Content != null && response_.Content.Headers != null)
- {
- foreach (var item_ in response_.Content.Headers)
- headers_[item_.Key] = item_.Value;
- }
-
- ProcessResponse(client_, response_);
-
- var status_ = (int)response_.StatusCode;
- if (status_ == 200)
- {
- var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false);
- if (objectResponse_.Object == null)
- {
- throw new DevilDaggersInfoApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null);
- }
- return objectResponse_.Object;
- }
- else
- if (status_ == 404)
- {
- var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false);
- if (objectResponse_.Object == null)
- {
- throw new DevilDaggersInfoApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null);
- }
- throw new DevilDaggersInfoApiException("A server side error occurred.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null);
- }
- else
- {
- var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false);
- throw new DevilDaggersInfoApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null);
- }
- }
- finally
- {
- if (disposeResponse_)
- response_.Dispose();
- }
- }
- }
- finally
- {
- if (disposeClient_)
- client_.Dispose();
- }
- }
-
- /// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
- /// A server side error occurred.
- public virtual async System.Threading.Tasks.Task Spawnsets_GetTotalSpawnsetDataAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
- {
- var urlBuilder_ = new System.Text.StringBuilder();
- urlBuilder_.Append("api/spawnsets/total-data");
-
- var client_ = _httpClient;
- var disposeClient_ = false;
- try
- {
- using (var request_ = new System.Net.Http.HttpRequestMessage())
- {
- request_.Method = new System.Net.Http.HttpMethod("GET");
- request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json"));
-
- PrepareRequest(client_, request_, urlBuilder_);
-
- var url_ = urlBuilder_.ToString();
- request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute);
-
- PrepareRequest(client_, request_, url_);
-
- var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false);
- var disposeResponse_ = true;
- try
- {
- var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value);
- if (response_.Content != null && response_.Content.Headers != null)
- {
- foreach (var item_ in response_.Content.Headers)
- headers_[item_.Key] = item_.Value;
- }
-
- ProcessResponse(client_, response_);
-
- var status_ = (int)response_.StatusCode;
- if (status_ == 200)
- {
- var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false);
- if (objectResponse_.Object == null)
- {
- throw new DevilDaggersInfoApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null);
- }
- return objectResponse_.Object;
- }
- else
- {
- var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false);
- throw new DevilDaggersInfoApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null);
- }
- }
- finally
- {
- if (disposeResponse_)
- response_.Dispose();
- }
- }
- }
- finally
- {
- if (disposeClient_)
- client_.Dispose();
- }
- }
-
- /// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
- /// A server side error occurred.
- public virtual async System.Threading.Tasks.Task Spawnsets_GetSpawnsetFileAsync(string? fileName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
- {
- var urlBuilder_ = new System.Text.StringBuilder();
- urlBuilder_.Append("api/spawnsets/{fileName}/file");
- urlBuilder_.Replace("{fileName}", System.Uri.EscapeDataString(ConvertToString(fileName, System.Globalization.CultureInfo.InvariantCulture)));
-
- var client_ = _httpClient;
- var disposeClient_ = false;
- try
- {
- using (var request_ = new System.Net.Http.HttpRequestMessage())
- {
- request_.Method = new System.Net.Http.HttpMethod("GET");
- request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/octet-stream"));
-
- PrepareRequest(client_, request_, urlBuilder_);
-
- var url_ = urlBuilder_.ToString();
- request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute);
-
- PrepareRequest(client_, request_, url_);
-
- var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false);
- var disposeResponse_ = true;
- try
- {
- var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value);
- if (response_.Content != null && response_.Content.Headers != null)
- {
- foreach (var item_ in response_.Content.Headers)
- headers_[item_.Key] = item_.Value;
- }
-
- ProcessResponse(client_, response_);
-
- var status_ = (int)response_.StatusCode;
- if (status_ == 200 || status_ == 206)
- {
- var responseStream_ = response_.Content == null ? System.IO.Stream.Null : await response_.Content.ReadAsStreamAsync().ConfigureAwait(false);
- var fileResponse_ = new FileResponse(status_, headers_, responseStream_, null, response_);
- disposeClient_ = false; disposeResponse_ = false; // response and client are disposed by FileResponse
- return fileResponse_;
- }
- else
- if (status_ == 400)
- {
- var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false);
- if (objectResponse_.Object == null)
- {
- throw new DevilDaggersInfoApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null);
- }
- throw new DevilDaggersInfoApiException("A server side error occurred.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null);
- }
- else
- if (status_ == 404)
- {
- var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false);
- if (objectResponse_.Object == null)
- {
- throw new DevilDaggersInfoApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null);
- }
- throw new DevilDaggersInfoApiException("A server side error occurred.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null);
- }
- else
- {
- var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false);
- throw new DevilDaggersInfoApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null);
- }
- }
- finally
- {
- if (disposeResponse_)
- response_.Dispose();
- }
- }
- }
- finally
- {
- if (disposeClient_)
- client_.Dispose();
- }
- }
-
- /// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
- /// A server side error occurred.
- public virtual async System.Threading.Tasks.Task Spawnsets_GetSpawnsetByIdAsync(int id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
- {
- if (id == null)
- throw new System.ArgumentNullException("id");
-
- var urlBuilder_ = new System.Text.StringBuilder();
- urlBuilder_.Append("api/spawnsets/{id}");
- urlBuilder_.Replace("{id}", System.Uri.EscapeDataString(ConvertToString(id, System.Globalization.CultureInfo.InvariantCulture)));
-
- var client_ = _httpClient;
- var disposeClient_ = false;
- try
- {
- using (var request_ = new System.Net.Http.HttpRequestMessage())
- {
- request_.Method = new System.Net.Http.HttpMethod("GET");
- request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json"));
-
- PrepareRequest(client_, request_, urlBuilder_);
-
- var url_ = urlBuilder_.ToString();
- request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute);
-
- PrepareRequest(client_, request_, url_);
-
- var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false);
- var disposeResponse_ = true;
- try
- {
- var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value);
- if (response_.Content != null && response_.Content.Headers != null)
- {
- foreach (var item_ in response_.Content.Headers)
- headers_[item_.Key] = item_.Value;
- }
-
- ProcessResponse(client_, response_);
-
- var status_ = (int)response_.StatusCode;
- if (status_ == 200)
- {
- var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false);
- if (objectResponse_.Object == null)
- {
- throw new DevilDaggersInfoApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null);
- }
- return objectResponse_.Object;
- }
- else
- if (status_ == 400)
- {
- var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false);
- if (objectResponse_.Object == null)
- {
- throw new DevilDaggersInfoApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null);
- }
- throw new DevilDaggersInfoApiException("A server side error occurred.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null);
- }
- else
- if (status_ == 404)
- {
- var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false);
- if (objectResponse_.Object == null)
- {
- throw new DevilDaggersInfoApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null);
- }
- throw new DevilDaggersInfoApiException("A server side error occurred.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null);
- }
- else
- {
- var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false);
- throw new DevilDaggersInfoApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null);
- }
- }
- finally
- {
- if (disposeResponse_)
- response_.Dispose();
- }
- }
- }
- finally
- {
- if (disposeClient_)
- client_.Dispose();
- }
- }
-
- /// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
- /// A server side error occurred.
- public virtual async System.Threading.Tasks.Task Spawnsets_GetDefaultSpawnsetAsync(GameVersion? gameVersion = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
- {
- var urlBuilder_ = new System.Text.StringBuilder();
- urlBuilder_.Append("api/spawnsets/default?");
- if (gameVersion != null)
- {
- urlBuilder_.Append(System.Uri.EscapeDataString("gameVersion") + "=").Append(System.Uri.EscapeDataString(ConvertToString(gameVersion, System.Globalization.CultureInfo.InvariantCulture))).Append("&");
- }
- urlBuilder_.Length--;
-
- var client_ = _httpClient;
- var disposeClient_ = false;
- try
- {
- using (var request_ = new System.Net.Http.HttpRequestMessage())
- {
- request_.Method = new System.Net.Http.HttpMethod("GET");
- request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json"));
-
- PrepareRequest(client_, request_, urlBuilder_);
-
- var url_ = urlBuilder_.ToString();
- request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute);
-
- PrepareRequest(client_, request_, url_);
-
- var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false);
- var disposeResponse_ = true;
- try
- {
- var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value);
- if (response_.Content != null && response_.Content.Headers != null)
- {
- foreach (var item_ in response_.Content.Headers)
- headers_[item_.Key] = item_.Value;
- }
-
- ProcessResponse(client_, response_);
-
- var status_ = (int)response_.StatusCode;
- if (status_ == 200)
- {
- var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false);
- if (objectResponse_.Object == null)
- {
- throw new DevilDaggersInfoApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null);
- }
- return objectResponse_.Object;
- }
- else
- if (status_ == 404)
- {
- var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false);
- if (objectResponse_.Object == null)
- {
- throw new DevilDaggersInfoApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null);
- }
- throw new DevilDaggersInfoApiException("A server side error occurred.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null);
- }
- else
- {
- var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false);
- throw new DevilDaggersInfoApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null);
- }
- }
- finally
- {
- if (disposeResponse_)
- response_.Dispose();
- }
- }
- }
- finally
- {
- if (disposeClient_)
- client_.Dispose();
- }
- }
-
- /// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
- /// A server side error occurred.
- public virtual async System.Threading.Tasks.Task> Spawnsets_GetSpawnsetsByAuthorIdAsync(int? playerId = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
- {
- var urlBuilder_ = new System.Text.StringBuilder();
- urlBuilder_.Append("api/spawnsets/by-author?");
- if (playerId != null)
- {
- urlBuilder_.Append(System.Uri.EscapeDataString("playerId") + "=").Append(System.Uri.EscapeDataString(ConvertToString(playerId, System.Globalization.CultureInfo.InvariantCulture))).Append("&");
- }
- urlBuilder_.Length--;
-
- var client_ = _httpClient;
- var disposeClient_ = false;
- try
- {
- using (var request_ = new System.Net.Http.HttpRequestMessage())
- {
- request_.Method = new System.Net.Http.HttpMethod("GET");
- request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json"));
-
- PrepareRequest(client_, request_, urlBuilder_);
-
- var url_ = urlBuilder_.ToString();
- request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute);
-
- PrepareRequest(client_, request_, url_);
-
- var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false);
- var disposeResponse_ = true;
- try
- {
- var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value);
- if (response_.Content != null && response_.Content.Headers != null)
- {
- foreach (var item_ in response_.Content.Headers)
- headers_[item_.Key] = item_.Value;
- }
-
- ProcessResponse(client_, response_);
-
- var status_ = (int)response_.StatusCode;
- if (status_ == 200)
- {
- var objectResponse_ = await ReadObjectResponseAsync>(response_, headers_, cancellationToken).ConfigureAwait(false);
- if (objectResponse_.Object == null)
- {
- throw new DevilDaggersInfoApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null);
- }
- return objectResponse_.Object;
- }
- else
- {
- var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false);
- throw new DevilDaggersInfoApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null);
- }
- }
- finally
- {
- if (disposeResponse_)
- response_.Dispose();
- }
- }
- }
- finally
- {
- if (disposeClient_)
- client_.Dispose();
- }
- }
-
- /// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
- /// A server side error occurred.
- public virtual async System.Threading.Tasks.Task Tools_GetToolAsync(string? toolName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
- {
- var urlBuilder_ = new System.Text.StringBuilder();
- urlBuilder_.Append("api/tools/{toolName}");
- urlBuilder_.Replace("{toolName}", System.Uri.EscapeDataString(ConvertToString(toolName, System.Globalization.CultureInfo.InvariantCulture)));
-
- var client_ = _httpClient;
- var disposeClient_ = false;
- try
- {
- using (var request_ = new System.Net.Http.HttpRequestMessage())
- {
- request_.Method = new System.Net.Http.HttpMethod("GET");
- request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json"));
-
- PrepareRequest(client_, request_, urlBuilder_);
-
- var url_ = urlBuilder_.ToString();
- request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute);
-
- PrepareRequest(client_, request_, url_);
-
- var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false);
- var disposeResponse_ = true;
- try
- {
- var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value);
- if (response_.Content != null && response_.Content.Headers != null)
- {
- foreach (var item_ in response_.Content.Headers)
- headers_[item_.Key] = item_.Value;
- }
-
- ProcessResponse(client_, response_);
-
- var status_ = (int)response_.StatusCode;
- if (status_ == 200)
- {
- var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false);
- if (objectResponse_.Object == null)
- {
- throw new DevilDaggersInfoApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null);
- }
- return objectResponse_.Object;
- }
- else
- if (status_ == 400)
- {
- var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false);
- if (objectResponse_.Object == null)
- {
- throw new DevilDaggersInfoApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null);
- }
- throw new DevilDaggersInfoApiException("A server side error occurred.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null);
- }
- else
- if (status_ == 404)
- {
- var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false);
- if (objectResponse_.Object == null)
- {
- throw new DevilDaggersInfoApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null);
- }
- throw new DevilDaggersInfoApiException("A server side error occurred.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null);
- }
- else
- {
- var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false);
- throw new DevilDaggersInfoApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null);
- }
- }
- finally
- {
- if (disposeResponse_)
- response_.Dispose();
- }
- }
- }
- finally
- {
- if (disposeClient_)
- client_.Dispose();
- }
- }
-
- /// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
- /// A server side error occurred.
- public virtual async System.Threading.Tasks.Task Tools_GetToolDistributionFileAsync(string? toolName, ToolPublishMethod? publishMethod = null, ToolBuildType? buildType = null, string? version = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
- {
- var urlBuilder_ = new System.Text.StringBuilder();
- urlBuilder_.Append("api/tools/{toolName}/file?");
- urlBuilder_.Replace("{toolName}", System.Uri.EscapeDataString(ConvertToString(toolName, System.Globalization.CultureInfo.InvariantCulture)));
- if (publishMethod != null)
- {
- urlBuilder_.Append(System.Uri.EscapeDataString("publishMethod") + "=").Append(System.Uri.EscapeDataString(ConvertToString(publishMethod, System.Globalization.CultureInfo.InvariantCulture))).Append("&");
- }
- if (buildType != null)
- {
- urlBuilder_.Append(System.Uri.EscapeDataString("buildType") + "=").Append(System.Uri.EscapeDataString(ConvertToString(buildType, System.Globalization.CultureInfo.InvariantCulture))).Append("&");
- }
- if (version != null)
- {
- urlBuilder_.Append(System.Uri.EscapeDataString("version") + "=").Append(System.Uri.EscapeDataString(ConvertToString(version, System.Globalization.CultureInfo.InvariantCulture))).Append("&");
- }
- urlBuilder_.Length--;
-
- var client_ = _httpClient;
- var disposeClient_ = false;
- try
- {
- using (var request_ = new System.Net.Http.HttpRequestMessage())
- {
- request_.Method = new System.Net.Http.HttpMethod("GET");
- request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/octet-stream"));
-
- PrepareRequest(client_, request_, urlBuilder_);
-
- var url_ = urlBuilder_.ToString();
- request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute);
-
- PrepareRequest(client_, request_, url_);
-
- var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false);
- var disposeResponse_ = true;
- try
- {
- var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value);
- if (response_.Content != null && response_.Content.Headers != null)
- {
- foreach (var item_ in response_.Content.Headers)
- headers_[item_.Key] = item_.Value;
- }
-
- ProcessResponse(client_, response_);
-
- var status_ = (int)response_.StatusCode;
- if (status_ == 200 || status_ == 206)
- {
- var responseStream_ = response_.Content == null ? System.IO.Stream.Null : await response_.Content.ReadAsStreamAsync().ConfigureAwait(false);
- var fileResponse_ = new FileResponse(status_, headers_, responseStream_, null, response_);
- disposeClient_ = false; disposeResponse_ = false; // response and client are disposed by FileResponse
- return fileResponse_;
- }
- else
- if (status_ == 400)
- {
- var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false);
- if (objectResponse_.Object == null)
- {
- throw new DevilDaggersInfoApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null);
- }
- throw new DevilDaggersInfoApiException("A server side error occurred.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null);
- }
- else
- if (status_ == 404)
- {
- var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false);
- if (objectResponse_.Object == null)
- {
- throw new DevilDaggersInfoApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null);
- }
- throw new DevilDaggersInfoApiException("A server side error occurred.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null);
- }
- else
- {
- var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false);
- throw new DevilDaggersInfoApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null);
- }
- }
- finally
- {
- if (disposeResponse_)
- response_.Dispose();
- }
- }
- }
- finally
- {
- if (disposeClient_)
- client_.Dispose();
- }
- }
-
- /// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
- /// A server side error occurred.
- public virtual async System.Threading.Tasks.Task Tools_GetLatestToolDistributionAsync(string? toolName, ToolPublishMethod? publishMethod = null, ToolBuildType? buildType = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
- {
- var urlBuilder_ = new System.Text.StringBuilder();
- urlBuilder_.Append("api/tools/{toolName}/distribution-latest?");
- urlBuilder_.Replace("{toolName}", System.Uri.EscapeDataString(ConvertToString(toolName, System.Globalization.CultureInfo.InvariantCulture)));
- if (publishMethod != null)
- {
- urlBuilder_.Append(System.Uri.EscapeDataString("publishMethod") + "=").Append(System.Uri.EscapeDataString(ConvertToString(publishMethod, System.Globalization.CultureInfo.InvariantCulture))).Append("&");
- }
- if (buildType != null)
- {
- urlBuilder_.Append(System.Uri.EscapeDataString("buildType") + "=").Append(System.Uri.EscapeDataString(ConvertToString(buildType, System.Globalization.CultureInfo.InvariantCulture))).Append("&");
- }
- urlBuilder_.Length--;
-
- var client_ = _httpClient;
- var disposeClient_ = false;
- try
- {
- using (var request_ = new System.Net.Http.HttpRequestMessage())
- {
- request_.Method = new System.Net.Http.HttpMethod("GET");
- request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json"));
-
- PrepareRequest(client_, request_, urlBuilder_);
-
- var url_ = urlBuilder_.ToString();
- request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute);
-
- PrepareRequest(client_, request_, url_);
-
- var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false);
- var disposeResponse_ = true;
- try
- {
- var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value);
- if (response_.Content != null && response_.Content.Headers != null)
- {
- foreach (var item_ in response_.Content.Headers)
- headers_[item_.Key] = item_.Value;
- }
-
- ProcessResponse(client_, response_);
-
- var status_ = (int)response_.StatusCode;
- if (status_ == 200)
- {
- var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false);
- if (objectResponse_.Object == null)
- {
- throw new DevilDaggersInfoApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null);
- }
- return objectResponse_.Object;
- }
- else
- if (status_ == 400)
- {
- var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false);
- if (objectResponse_.Object == null)
- {
- throw new DevilDaggersInfoApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null);
- }
- throw new DevilDaggersInfoApiException("A server side error occurred.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null);
- }
- else
- if (status_ == 404)
- {
- var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false);
- if (objectResponse_.Object == null)
- {
- throw new DevilDaggersInfoApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null);
- }
- throw new DevilDaggersInfoApiException("A server side error occurred.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null);
- }
- else
- {
- var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false);
- throw new DevilDaggersInfoApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null);
- }
- }
- finally
- {
- if (disposeResponse_)
- response_.Dispose();
- }
- }
- }
- finally
- {
- if (disposeClient_)
- client_.Dispose();
- }
- }
-
- /// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
- /// A server side error occurred.
- public virtual async System.Threading.Tasks.Task Tools_GetToolDistributionByVersionAsync(string? toolName, ToolPublishMethod? publishMethod = null, ToolBuildType? buildType = null, string? version = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
- {
- var urlBuilder_ = new System.Text.StringBuilder();
- urlBuilder_.Append("api/tools/{toolName}/distribution?");
- urlBuilder_.Replace("{toolName}", System.Uri.EscapeDataString(ConvertToString(toolName, System.Globalization.CultureInfo.InvariantCulture)));
- if (publishMethod != null)
- {
- urlBuilder_.Append(System.Uri.EscapeDataString("publishMethod") + "=").Append(System.Uri.EscapeDataString(ConvertToString(publishMethod, System.Globalization.CultureInfo.InvariantCulture))).Append("&");
- }
- if (buildType != null)
- {
- urlBuilder_.Append(System.Uri.EscapeDataString("buildType") + "=").Append(System.Uri.EscapeDataString(ConvertToString(buildType, System.Globalization.CultureInfo.InvariantCulture))).Append("&");
- }
- if (version != null)
- {
- urlBuilder_.Append(System.Uri.EscapeDataString("version") + "=").Append(System.Uri.EscapeDataString(ConvertToString(version, System.Globalization.CultureInfo.InvariantCulture))).Append("&");
- }
- urlBuilder_.Length--;
-
- var client_ = _httpClient;
- var disposeClient_ = false;
- try
- {
- using (var request_ = new System.Net.Http.HttpRequestMessage())
- {
- request_.Method = new System.Net.Http.HttpMethod("GET");
- request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json"));
-
- PrepareRequest(client_, request_, urlBuilder_);
-
- var url_ = urlBuilder_.ToString();
- request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute);
-
- PrepareRequest(client_, request_, url_);
-
- var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false);
- var disposeResponse_ = true;
- try
- {
- var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value);
- if (response_.Content != null && response_.Content.Headers != null)
- {
- foreach (var item_ in response_.Content.Headers)
- headers_[item_.Key] = item_.Value;
- }
-
- ProcessResponse(client_, response_);
-
- var status_ = (int)response_.StatusCode;
- if (status_ == 200)
- {
- var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false);
- if (objectResponse_.Object == null)
- {
- throw new DevilDaggersInfoApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null);
- }
- return objectResponse_.Object;
- }
- else
- if (status_ == 400)
- {
- var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false);
- if (objectResponse_.Object == null)
- {
- throw new DevilDaggersInfoApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null);
- }
- throw new DevilDaggersInfoApiException("A server side error occurred.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null);
- }
- else
- if (status_ == 404)
- {
- var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false);
- if (objectResponse_.Object == null)
- {
- throw new DevilDaggersInfoApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null);
- }
- throw new DevilDaggersInfoApiException("A server side error occurred.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null);
- }
- else
- {
- var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false);
- throw new DevilDaggersInfoApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null);
- }
- }
- finally
- {
- if (disposeResponse_)
- response_.Dispose();
- }
- }
- }
- finally
- {
- if (disposeClient_)
- client_.Dispose();
- }
- }
-
- /// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
- /// A server side error occurred.
- public virtual async System.Threading.Tasks.Task WorldRecords_GetWorldRecordDataAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
- {
- var urlBuilder_ = new System.Text.StringBuilder();
- urlBuilder_.Append("api/world-records");
-
- var client_ = _httpClient;
- var disposeClient_ = false;
- try
- {
- using (var request_ = new System.Net.Http.HttpRequestMessage())
- {
- request_.Method = new System.Net.Http.HttpMethod("GET");
- request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json"));
-
- PrepareRequest(client_, request_, urlBuilder_);
-
- var url_ = urlBuilder_.ToString();
- request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute);
-
- PrepareRequest(client_, request_, url_);
-
- var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false);
- var disposeResponse_ = true;
- try
- {
- var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value);
- if (response_.Content != null && response_.Content.Headers != null)
- {
- foreach (var item_ in response_.Content.Headers)
- headers_[item_.Key] = item_.Value;
- }
-
- ProcessResponse(client_, response_);
-
- var status_ = (int)response_.StatusCode;
- if (status_ == 200)
- {
- var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false);
- if (objectResponse_.Object == null)
- {
- throw new DevilDaggersInfoApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null);
- }
- return objectResponse_.Object;
- }
- else
- {
- var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false);
- throw new DevilDaggersInfoApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null);
- }
- }
- finally
- {
- if (disposeResponse_)
- response_.Dispose();
- }
- }
- }
- finally
- {
- if (disposeClient_)
- client_.Dispose();
- }
- }
-
- protected struct ObjectResponseResult
- {
- public ObjectResponseResult(T responseObject, string responseText)
- {
- this.Object = responseObject;
- this.Text = responseText;
- }
-
- public T Object { get; }
-
- public string Text { get; }
- }
-
- public bool ReadResponseAsString { get; set; }
-
- protected virtual async System.Threading.Tasks.Task> ReadObjectResponseAsync(System.Net.Http.HttpResponseMessage response, System.Collections.Generic.IReadOnlyDictionary> headers, System.Threading.CancellationToken cancellationToken)
- {
- if (response == null || response.Content == null)
- {
- return new ObjectResponseResult(default(T)!, string.Empty);
- }
-
- if (ReadResponseAsString)
- {
- var responseText = await response.Content.ReadAsStringAsync().ConfigureAwait(false);
- try
- {
- var typedBody = Newtonsoft.Json.JsonConvert.DeserializeObject(responseText, JsonSerializerSettings);
- return new ObjectResponseResult(typedBody!, responseText);
- }
- catch (Newtonsoft.Json.JsonException exception)
- {
- var message = "Could not deserialize the response body string as " + typeof(T).FullName + ".";
- throw new DevilDaggersInfoApiException(message, (int)response.StatusCode, responseText, headers, exception);
- }
- }
- else
- {
- try
- {
- using (var responseStream = await response.Content.ReadAsStreamAsync().ConfigureAwait(false))
- using (var streamReader = new System.IO.StreamReader(responseStream))
- using (var jsonTextReader = new Newtonsoft.Json.JsonTextReader(streamReader))
- {
- var serializer = Newtonsoft.Json.JsonSerializer.Create(JsonSerializerSettings);
- var typedBody = serializer.Deserialize(jsonTextReader);
- return new ObjectResponseResult(typedBody!, string.Empty);
- }
- }
- catch (Newtonsoft.Json.JsonException exception)
- {
- var message = "Could not deserialize the response body stream as " + typeof(T).FullName + ".";
- throw new DevilDaggersInfoApiException(message, (int)response.StatusCode, string.Empty, headers, exception);
- }
- }
- }
-
- private string ConvertToString(object? value, System.Globalization.CultureInfo cultureInfo)
- {
- if (value == null)
- {
- return "";
- }
-
- if (value is System.Enum)
- {
- var name = System.Enum.GetName(value.GetType(), value);
- if (name != null)
- {
- var field = System.Reflection.IntrospectionExtensions.GetTypeInfo(value.GetType()).GetDeclaredField(name);
- if (field != null)
- {
- var attribute = System.Reflection.CustomAttributeExtensions.GetCustomAttribute(field, typeof(System.Runtime.Serialization.EnumMemberAttribute))
- as System.Runtime.Serialization.EnumMemberAttribute;
- if (attribute != null)
- {
- return attribute.Value != null ? attribute.Value : name;
- }
- }
-
- var converted = System.Convert.ToString(System.Convert.ChangeType(value, System.Enum.GetUnderlyingType(value.GetType()), cultureInfo));
- return converted == null ? string.Empty : converted;
- }
- }
- else if (value is bool)
- {
- return System.Convert.ToString((bool)value, cultureInfo).ToLowerInvariant();
- }
- else if (value is byte[])
- {
- return System.Convert.ToBase64String((byte[]) value);
- }
- else if (value.GetType().IsArray)
- {
- var array = System.Linq.Enumerable.OfType