Skip to content

Commit f32b21b

Browse files
authored
[chore] Add missing docstrings (#522)
1 parent 45f3e65 commit f32b21b

File tree

4 files changed

+52
-1
lines changed

4 files changed

+52
-1
lines changed

EasyPost/Hooks.cs

+12-1
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11
using System;
2-
using System.Collections.Generic;
32
using System.Net;
43
using System.Net.Http;
54
using System.Net.Http.Headers;
5+
using EasyPost._base;
66

77
namespace EasyPost;
88

9+
/// <summary>
10+
/// Class representing a set of callbacks to use for introspecting API requests made by an <see cref="EasyPostClient"/>.
11+
/// </summary>
912
public class Hooks
1013
{
1114
/// <summary>
@@ -20,6 +23,10 @@ public class Hooks
2023
public EventHandler<OnRequestResponseReceivedEventArgs>? OnRequestResponseReceived { get; set; }
2124
}
2225

26+
/// <summary>
27+
/// Represents a set of <see cref="EventArgs"/> containing information about an in-flight HTTP request.
28+
/// This set is passed into the <see cref="Hooks.OnRequestExecuting"/> event handler.
29+
/// </summary>
2330
public class OnRequestExecutingEventArgs : EventArgs
2431
{
2532
/// <summary>
@@ -71,6 +78,10 @@ internal OnRequestExecutingEventArgs(HttpRequestMessage request, int timestamp,
7178
}
7279
}
7380

81+
/// <summary>
82+
/// Represents a set of <see cref="EventArgs"/> containing information about an HTTP response received by the client.
83+
/// This set is passed into the <see cref="Hooks.OnRequestResponseReceived"/> event handler.
84+
/// </summary>
7485
public class OnRequestResponseReceivedEventArgs : EventArgs
7586
{
7687
/// <summary>

EasyPost/Models/API/CarrierAccountType.cs

+26
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,44 @@
33

44
namespace EasyPost.Models.API;
55

6+
/// <summary>
7+
/// Enums representing specific carrier account types.
8+
/// </summary>
69
public class CarrierAccountType : ValueEnum
710
{
11+
/// <summary>
12+
/// Represents a FedEx carrier account.
13+
/// </summary>
814
public static readonly CarrierAccountType FedEx = new CarrierAccountType(26, "FedexAccount");
15+
16+
/// <summary>
17+
/// Represents a FedEx SmartPost carrier account.
18+
/// </summary>
919
public static readonly CarrierAccountType FedExSmartPost = new CarrierAccountType(30, "FedexSmartpostAccount");
20+
21+
/// <summary>
22+
/// Represents a UPS carrier account.
23+
/// </summary>
1024
public static readonly CarrierAccountType Ups = new CarrierAccountType(59, "UpsAccount");
1125

26+
/// <summary>
27+
/// Constructor for CarrierAccountType enum.
28+
/// </summary>
29+
/// <param name="id">Internal ID of the enum. Must be unique among all enums of this specific type.</param>
30+
/// <param name="name">Name of the carrier account type. Stored as the value associated with this enum.</param>
1231
private CarrierAccountType(int id, string name)
1332
: base(id, name)
1433
{
1534
}
1635

36+
/// <summary>
37+
/// Gets the name of this <see cref="CarrierAccountType"/>.
38+
/// </summary>
1739
public string Name => (string)Value;
1840

41+
/// <summary>
42+
/// Gets all <see cref="CarrierAccountType"/> enums.
43+
/// </summary>
44+
/// <returns></returns>
1945
public static IEnumerable<CarrierAccountType> All() => GetAll<CarrierAccountType>();
2046
}

EasyPost/Parameters/BaseParameters.cs

+2
Original file line numberDiff line numberDiff line change
@@ -231,10 +231,12 @@ private void Add(RequestParameterAttribute requestParameterAttribute, object? va
231231
// Get the key and update the list of keys
232232
string key = keys[0];
233233
keys = keys.Skip(1).ToArray();
234+
#pragma warning disable CA1854 // Don't want to use TryGetValue because no need for value
234235
if (!dictionary.ContainsKey(key))
235236
{
236237
dictionary[key] = UpdateDictionary(new Dictionary<string, object?>(), keys, value);
237238
}
239+
#pragma warning restore CA1854
238240

239241
object? subDirectory = dictionary[key];
240242
if (subDirectory is Dictionary<string, object?> subDictionary)

EasyPost/Parameters/IBaseParameters.cs

+12
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,22 @@
1212

1313
namespace EasyPost.Parameters
1414
{
15+
/// <summary>
16+
/// Base interface for all EasyPost API parameters.
17+
/// </summary>
1518
public interface IBaseParameters
1619
{
20+
/// <summary>
21+
/// Convert this object to a <see cref="Dictionary{TKey,TValue}"/>.
22+
/// </summary>
23+
/// <returns></returns>
1724
public Dictionary<string, object> ToDictionary();
1825

26+
/// <summary>
27+
/// Convert this object to a sub-<see cref="Dictionary{TKey,TValue}"/> based on the parent parameter object type.
28+
/// </summary>
29+
/// <param name="parentParameterObjectType"></param>
30+
/// <returns></returns>
1931
public Dictionary<string, object> ToSubDictionary(Type parentParameterObjectType);
2032
}
2133
}

0 commit comments

Comments
 (0)