@@ -14,6 +14,13 @@ import { MiddlewareControl } from "../MiddlewareControl";
1414
1515import { MiddlewareOptions } from "./IMiddlewareOptions" ;
1616
17+ /**
18+ * @enum
19+ * @property {number } NONE - The hexadecimal flag value for nothing enabled
20+ * @property {number } REDIRECT_HANDLER_ENABLED - The hexadecimal flag value for redirect handler enabled
21+ * @property {number } RETRY_HANDLER_ENABLED - The hexadecimal flag value for retry handler enabled
22+ * @property {number } AUTHENTICATION_HANDLER_ENABLED - The hexadecimal flag value for the authentication handler enabled
23+ */
1724export enum FeatureUsageFlag {
1825 NONE = 0x0 ,
1926 REDIRECT_HANDLER_ENABLED = 0x1 ,
@@ -28,8 +35,20 @@ export enum FeatureUsageFlag {
2835 */
2936
3037export class TelemetryHandlerOptions implements MiddlewareOptions {
38+ /**
39+ * @private
40+ * A member to hold the OR of feature usage flags
41+ */
3142 private featureUsage : FeatureUsageFlag = FeatureUsageFlag . NONE ;
3243
44+ /**
45+ * @public
46+ * @static
47+ * To update the feature usage in the context object
48+ * @param {Context } context - The request context object containing middleware options
49+ * @param {FeatureUsageFlag } flag - The flag value
50+ * @returns nothing
51+ */
3352 public static updateFeatureUsageFlag ( context : Context , flag : FeatureUsageFlag ) : void {
3453 let options : TelemetryHandlerOptions ;
3554 if ( context . middlewareControl instanceof MiddlewareControl ) {
@@ -44,12 +63,23 @@ export class TelemetryHandlerOptions implements MiddlewareOptions {
4463 options . setFeatureUsage ( flag ) ;
4564 }
4665
47- public setFeatureUsage ( flag : FeatureUsageFlag ) : void {
66+ /**
67+ * @private
68+ * To set the feature usage flag
69+ * @param {FeatureUsageFlag } flag - The flag value
70+ * @returns nothing
71+ */
72+ private setFeatureUsage ( flag : FeatureUsageFlag ) : void {
4873 /* tslint:disable: no-bitwise */
4974 this . featureUsage = this . featureUsage | flag ;
5075 /* tslint:enable: no-bitwise */
5176 }
5277
78+ /**
79+ * @public
80+ * To get the feature usage
81+ * @returns A feature usage flag as hexadecimal string
82+ */
5383 public getFeatureUsage ( ) : string {
5484 return this . featureUsage . toString ( 16 ) ;
5585 }
0 commit comments