From 293461c5d9aaedb3b9d37280999aac3757f57b84 Mon Sep 17 00:00:00 2001 From: Citrinate Date: Thu, 29 Feb 2024 15:20:27 -0500 Subject: [PATCH] Improve swagger documentation --- CS2Interface/Data/InspectItem.cs | 12 +++--- CS2Interface/Data/InventoryItem.cs | 12 +++--- CS2Interface/Data/Item.cs | 64 +++++++++++++++--------------- CS2Interface/Data/ItemData.cs | 10 ++--- CS2Interface/Data/ItemDef.cs | 2 +- CS2Interface/Helpers/IAttribute.cs | 19 +++++---- 6 files changed, 59 insertions(+), 60 deletions(-) diff --git a/CS2Interface/Data/InspectItem.cs b/CS2Interface/Data/InspectItem.cs index 1419f3c..45d8345 100644 --- a/CS2Interface/Data/InspectItem.cs +++ b/CS2Interface/Data/InspectItem.cs @@ -4,14 +4,14 @@ using SteamKit2.GC.CSGO.Internal; namespace CS2Interface { - internal sealed class InspectItem : Item { + public sealed class InspectItem : Item { [JsonInclude] [JsonPropertyName("iteminfo")] - internal CEconItemPreviewDataBlock ItemInfo { get; private init; } - internal string s; - internal string a; - internal string d; - internal string m; + public CEconItemPreviewDataBlock ItemInfo { get; private init; } + public string s; + public string a; + public string d; + public string m; internal InspectItem(CMsgGCCStrike15_v2_Client2GCEconPreviewDataBlockResponse item, ulong param_s, ulong param_a, ulong param_d, ulong param_m) { ItemInfo = item.iteminfo; diff --git a/CS2Interface/Data/InventoryItem.cs b/CS2Interface/Data/InventoryItem.cs index feca126..498dfe2 100644 --- a/CS2Interface/Data/InventoryItem.cs +++ b/CS2Interface/Data/InventoryItem.cs @@ -8,27 +8,27 @@ using SteamKit2.GC.CSGO.Internal; namespace CS2Interface { - internal sealed class InventoryItem : Item { + public sealed class InventoryItem : Item { [JsonInclude] [JsonPropertyName("iteminfo")] - internal CSOEconItem ItemInfo { get; private init; } + public CSOEconItem ItemInfo { get; private init; } [JsonInclude] [JsonPropertyName("attributes")] [JsonConverter (typeof(AttributeConverter))] - internal Dictionary? Attributes { get; private set; } + public Dictionary? Attributes { get; private set; } [JsonInclude] [JsonPropertyName("position")] - internal uint? Position { get; private set; } + public uint? Position { get; private set; } [JsonInclude] [JsonPropertyName("casket_id")] - internal ulong? CasketID { get; private set; } + public ulong? CasketID { get; private set; } [JsonInclude] [JsonPropertyName("moveable")] - internal bool? Moveable { get; private set; } + public bool? Moveable { get; private set; } public bool ShouldSerializeAttributes() => Attributes != null && ShouldSerializeAdditionalProperties; public bool ShouldSerializePosition() => Position != null && ShouldSerializeAdditionalProperties; diff --git a/CS2Interface/Data/Item.cs b/CS2Interface/Data/Item.cs index 17d6192..8cd26cb 100644 --- a/CS2Interface/Data/Item.cs +++ b/CS2Interface/Data/Item.cs @@ -4,107 +4,107 @@ using SteamKit2; namespace CS2Interface { - internal class Item { - internal uint DefIndex; - internal uint PaintIndex; - internal uint? StickerID; - internal uint? TintID; - internal uint? MusicID; - internal uint Quality; - internal uint Rarity; - internal uint Origin; + public class Item { + public uint DefIndex; + public uint PaintIndex; + public uint? StickerID; + public uint? TintID; + public uint? MusicID; + public uint Quality; + public uint Rarity; + public uint Origin; [JsonInclude] [JsonPropertyName("full_name")] - internal string? FullName { get; private set; } + public string? FullName { get; private set; } [JsonInclude] [JsonPropertyName("full_type_name")] - internal string? FullTypeName { get; private set; } + public string? FullTypeName { get; private set; } [JsonInclude] [JsonPropertyName("rarity_name")] - internal string? RarityName { get; private set; } + public string? RarityName { get; private set; } [JsonInclude] [JsonPropertyName("quality_name")] - internal string? QualityName { get; private set; } + public string? QualityName { get; private set; } [JsonInclude] [JsonPropertyName("origin_name")] - internal string? OriginName { get; private set; } + public string? OriginName { get; private set; } [JsonInclude] [JsonPropertyName("type_name")] - internal string? TypeName { get; private set; } + public string? TypeName { get; private set; } [JsonInclude] [JsonPropertyName("item_name")] - internal string? ItemName { get; private set; } + public string? ItemName { get; private set; } [JsonInclude] [JsonPropertyName("tool_name")] - internal string? ToolName { get; private set; } + public string? ToolName { get; private set; } [JsonInclude] [JsonPropertyName("tint_name")] - internal string? TintName { get; private set; } + public string? TintName { get; private set; } [JsonInclude] [JsonPropertyName("weapon_image_url")] - internal string? WeaponImageURL { get; private set; } + public string? WeaponImageURL { get; private set; } [JsonInclude] [JsonPropertyName("weapon_name")] - internal string? WeaponName { get; private set; } + public string? WeaponName { get; private set; } [JsonInclude] [JsonPropertyName("wear_name")] - internal string? WearName { get; private set; } + public string? WearName { get; private set; } [JsonInclude] [JsonPropertyName("wear")] - internal double? Wear { get; set; } + public double? Wear { get; set; } [JsonInclude] [JsonPropertyName("wear_min")] - internal float? WearMin { get; private set; } + public float? WearMin { get; private set; } [JsonInclude] [JsonPropertyName("wear_max")] - internal float? WearMax { get; private set; } + public float? WearMax { get; private set; } [JsonInclude] [JsonPropertyName("name_id")] - internal string? NameID { get; private set; } + public string? NameID { get; private set; } [JsonInclude] [JsonPropertyName("set_name_id")] - internal string? SetNameID { get; private set; } + public string? SetNameID { get; private set; } [JsonInclude] [JsonPropertyName("set_name")] - internal string? SetName { get; private set; } + public string? SetName { get; private set; } [JsonInclude] [JsonPropertyName("crate_name_id")] - internal string? CrateNameID { get; private set; } + public string? CrateNameID { get; private set; } [JsonInclude] [JsonPropertyName("crate_defindex")] - internal uint? CrateDefIndex { get; private set; } + public uint? CrateDefIndex { get; private set; } [JsonInclude] [JsonPropertyName("crate_supply_series")] - internal uint? CrateSupplySeries { get; private set; } + public uint? CrateSupplySeries { get; private set; } [JsonInclude] [JsonPropertyName("crate_name")] - internal string? CrateName { get; private set; } + public string? CrateName { get; private set; } [JsonInclude] [JsonPropertyName("defs")] - internal ItemData? ItemData { get; private set; } + public ItemData? ItemData { get; private set; } protected static bool ShouldSerializeAdditionalProperties = true; protected static bool ShouldSerializeDefs = true; diff --git a/CS2Interface/Data/ItemData.cs b/CS2Interface/Data/ItemData.cs index ea0ad4b..9dfa04a 100644 --- a/CS2Interface/Data/ItemData.cs +++ b/CS2Interface/Data/ItemData.cs @@ -4,22 +4,22 @@ using SteamKit2; namespace CS2Interface { - internal class ItemData { + public class ItemData { [JsonInclude] [JsonPropertyName("item_def")] - internal ItemDef ItemDef { get; private init; } + public ItemDef ItemDef { get; private init; } [JsonInclude] [JsonPropertyName("paint_kit_def")] - internal ItemDef? PaintKitDef { get; private init; } + public ItemDef? PaintKitDef { get; private init; } [JsonInclude] [JsonPropertyName("sticker_kit_def")] - internal ItemDef? StickerKitDef { get; private init; } + public ItemDef? StickerKitDef { get; private init; } [JsonInclude] [JsonPropertyName("music_def")] - internal ItemDef? MusicDef { get; private init; } + public ItemDef? MusicDef { get; private init; } public bool ShouldSerializeItemDef() => ItemDef != null; public bool ShouldSerializePaintKitDef() => PaintKitDef != null; diff --git a/CS2Interface/Data/ItemDef.cs b/CS2Interface/Data/ItemDef.cs index c167b8c..62ed4f3 100644 --- a/CS2Interface/Data/ItemDef.cs +++ b/CS2Interface/Data/ItemDef.cs @@ -5,7 +5,7 @@ using SteamKit2; namespace CS2Interface { - internal class ItemDef { + public class ItemDef { [JsonInclude] [JsonPropertyName("defs")] [JsonConverter(typeof(JsonListItemConverter))] diff --git a/CS2Interface/Helpers/IAttribute.cs b/CS2Interface/Helpers/IAttribute.cs index 689c9b6..691c168 100644 --- a/CS2Interface/Helpers/IAttribute.cs +++ b/CS2Interface/Helpers/IAttribute.cs @@ -2,29 +2,28 @@ namespace CS2Interface { public abstract partial class IAttribute { - public abstract string Name { get; } - public abstract Type Type { get; } + internal abstract string Name { get; } + internal abstract Type Type { get; } - public abstract uint ToUInt32(); + internal abstract uint ToUInt32(); - public abstract float ToSingle(); + internal abstract float ToSingle(); public override abstract string ToString(); } public sealed class Attribute : IAttribute where TObject : notnull { - public override string Name { get; } - public override Type Type { get => typeof(TObject); } - public TObject Value; + internal override string Name { get; } + internal override Type Type { get => typeof(TObject); } + internal TObject Value; public Attribute(string name, TObject value) { Name = name; Value = value; } - public override uint ToUInt32() => (uint) Convert.ChangeType(Value, typeof(uint)); - public override float ToSingle() => (float) Convert.ChangeType(Value, typeof(float)); - + internal override uint ToUInt32() => (uint) Convert.ChangeType(Value, typeof(uint)); + internal override float ToSingle() => (float) Convert.ChangeType(Value, typeof(float)); public override string ToString() => (string) Convert.ChangeType(Value, typeof(string)); } } \ No newline at end of file