Skip to content

Code documentation

Frédéric Jacques edited this page Jun 20, 2021 · 3 revisions

AzureDevOpsTeamMembersVelocity

IdentityHostingStartup AccessDeniedModel
ForgotPasswordConfirmation LockoutModel
LogoutModel InputModel
Disable2faModel EmailModel
InputModel ExternalLoginsModel
GenerateRecoveryCodesModel IndexModel
InputModel PersonalDataModel
RegisterConfirmationModel RegisterModel
InputModel ResetPasswordConfirmationModel
AllowAnonymousAuthorizationHandler AllowAnonymousStateProvider
AzureADController IdentityContext
AddAuthentificationExtension DictionaireExtension
JsonExtension ListResponse\`1
Capacity HrefObject
IdentityRef IdentityReference
MemberVelocity Sprint
SprintAttributes SprintLinks
WorkItem WorkItemLinks
WorkItems WorkItemUpdate
ErrorModel Program
DevOpsProxy IDevOpsProxy
AuthUrlPagesProvider DevOpsService
VelocityService Startup
TeamMembersVelocitySettings TeamProject

IdentityHostingStartup

Hosting startup class to add Identity services in the app

Configure(builder)

Method call at runtime to configure Identity

Name Description
builder Microsoft.AspNetCore.Hosting.IWebHostBuilder

AccessDeniedModel

Access denied page model.

OnGet

Append when the access denied page is GET

ForgotPasswordConfirmation

Forgat password confirmation page model

OnGet

Append when the forgot password confirmation page is GET

LockoutModel

Lockout page model

OnGet

Append when Lokout page is GET

LogoutModel

Logout page model

Constructor(signInManager, logger, authUrlPages)

Constructor with dependencies

Name Description
signInManager Microsoft.AspNetCore.Identity.SignInManager{Microsoft.AspNetCore.Identity.IdentityUser}
logger Microsoft.Extensions.Logging.ILogger{AzureDevOpsTeamMembersVelocity.Areas.Identity.Pages.Account.LogoutModel}
authUrlPages AzureDevOpsTeamMembersVelocity.Services.AuthUrlPagesProvider

OnGet

Append when logout page is GET

OnPost(returnUrl)

Append on POST of Logout page. Logout the user. This method is used in the Identity and AzureAD authentication method.

Name Description
returnUrl System.String
Url to redirect to after user is logout

Returns

AzureDevOpsTeamMembersVelocity.Areas.Identity.Pages.Account.Manage.DeletePersonalDataModel.Input

Input model of the Delete Personal Data page

InputModel

Input model of the Delete Personal Data page

Password

The password of the user

AzureDevOpsTeamMembersVelocity.Areas.Identity.Pages.Account.Manage.DeletePersonalDataModel.RequirePassword

Indicate if it required password

Disable2faModel

Disable Two-Factor authentication page model

EmailModel

Email page model

Constructor(Microsoft.AspNetCore.Identity.UserManager{Microsoft.AspNetCore.Identity.IdentityUser},Microsoft.AspNetCore.Identity.UI.Services.IEmailSender)

Constructor with dependencies

Email

Email

InputModel

Input model of the email page

NewEmail

New email field

AzureDevOpsTeamMembersVelocity.Areas.Identity.Pages.Account.Manage.EmailModel.IsEmailConfirmed

Is email confirmed

AzureDevOpsTeamMembersVelocity.Areas.Identity.Pages.Account.Manage.EmailModel.StatusMessage

Status message

AzureDevOpsTeamMembersVelocity.Areas.Identity.Pages.Account.Manage.EmailModel.Username

Username

ExternalLoginsModel

External login page model

Constructor(userManager, signInManager)

Constructor with dependencies

Name Description
userManager Microsoft.AspNetCore.Identity.UserManager{Microsoft.AspNetCore.Identity.IdentityUser}
signInManager Microsoft.AspNetCore.Identity.SignInManager{Microsoft.AspNetCore.Identity.IdentityUser}

GenerateRecoveryCodesModel

Generate recovery code page model

IndexModel

Index model page

Constructor(userManager, signInManager)

Constructor with dependencies

Name Description
userManager Microsoft.AspNetCore.Identity.UserManager{Microsoft.AspNetCore.Identity.IdentityUser}
signInManager Microsoft.AspNetCore.Identity.SignInManager{Microsoft.AspNetCore.Identity.IdentityUser}

Input

Input model of the Index page

InputModel

Input model of the Index page

PhoneNumber

The phone number of the user

AzureDevOpsTeamMembersVelocity.Areas.Identity.Pages.Account.Manage.IndexModel.OnGetAsync

Append when Index page is GET

Returns

AzureDevOpsTeamMembersVelocity.Areas.Identity.Pages.Account.Manage.IndexModel.OnPostAsync

Append on POST of the Index page.

Returns

AzureDevOpsTeamMembersVelocity.Areas.Identity.Pages.Account.Manage.IndexModel.StatusMessage

Status message to show the user

AzureDevOpsTeamMembersVelocity.Areas.Identity.Pages.Account.Manage.IndexModel.Username

The username

PersonalDataModel

Personal data page model

Constructor(userManager)

Constructor with dependencies

Name Description
userManager Microsoft.AspNetCore.Identity.UserManager{Microsoft.AspNetCore.Identity.IdentityUser}

OnGet

Append personal data page is GET.

Returns

RegisterConfirmationModel

Register confirmation page model

Constructor(userManager)

Constructor with dependencies

Name Description
userManager Microsoft.AspNetCore.Identity.UserManager{Microsoft.AspNetCore.Identity.IdentityUser}

RegisterModel

Register page model

Constructor(userManager, signInManager, logger, emailSender)

Constructor with dependencies

Name Description
userManager Microsoft.AspNetCore.Identity.UserManager{Microsoft.AspNetCore.Identity.IdentityUser}
signInManager Microsoft.AspNetCore.Identity.SignInManager{Microsoft.AspNetCore.Identity.IdentityUser}
logger Microsoft.Extensions.Logging.ILogger{AzureDevOpsTeamMembersVelocity.Areas.Identity.Pages.Account.RegisterModel}
emailSender Microsoft.AspNetCore.Identity.UI.Services.IEmailSender

InputModel

Input model of the register page

ConfirmPassword

The password confirmation

Email

The email of the user, also uses for the username.

Password

The password of the user

ResetPasswordConfirmationModel

Reset password confirmation page model.

OnGet

Append when resetting password confirmation model page is GET.

AllowAnonymousAuthorizationHandler

Handler use when no authentification is configured

HandleAsync(Microsoft.AspNetCore.Authorization.AuthorizationHandlerContext)

AllowAnonymousStateProvider

When no authentification method is configured, this authorization handler is used.

AzureADController

Controller used to manage redirection with Microsoft to login and logout users.

Login(returnUrl)

Login method to handle Microsoft authentication

Name Description
returnUrl System.String
The returnUrl use after the Microsoft authentication is completed

IdentityContext

The dbContext class is used when the environment variable USE_IDENTITY is set to true. This class has been auto-generated by a scaffolding tool.

Constructor(options)

Constructor used to instantiate an IdentityContext

Name Description
options Microsoft.EntityFrameworkCore.DbContextOptions{AzureDevOpsTeamMembersVelocity.Data.IdentityContext}

AddAuthentificationExtension

A class that handles the authorization configuration of the app. There or 4 possible modes of authentication. 1. No auth; if there is nothing configure about the authorization, then the app will work without any auth. 2. CookieAuth, if there is a COOKIEAUTH_USER defined. Then this user will have to log in to use the app. You can set a password with the COOKIE_PASSWORD environment variable. 3. Identity, if the environment variable USE_IDENTITY is set to true, Microsoft.Identity will be used with the SQLite database. 4. Microsoft account, if the environment variable MicrosoftId is initialized, then Microsoft account will be used. MicrosoftId represents the ClientId, and MicrosoftSecret is the secret create in the AzureAD client credentials section.

Remarks

You can use only one authentication method at a time. Otherwise, the application will throw an InvalidProgramException.

AddTeamMemberVelocityAutorisation(Microsoft.Extensions.DependencyInjection.IServiceCollection,Microsoft.Extensions.Configuration.IConfiguration)

System.InvalidProgramException:

DictionaireExtension

Extension class to help work with the Fields property of Microsoft DevOps models

Get``1(System.Collections.Generic.IDictionary{System.String,System.Object},System.String)

TryGet the value of the corresponding key. If the value is present, a cast is applied, and the value is returned.

Type Parameters

  • T - Type of the corresponding value

System.ArgumentNullException:

System.InvalidCastException:

Get``1(System.Collections.Generic.IReadOnlyDictionary{System.String,System.Object},System.String)

TryGet the value of the corresponding key. If the value is present, a cast is applied, and the value is returned.

Type Parameters

  • T - Type of the corresponding value

System.ArgumentNullException:

System.InvalidCastException:

MaybeGet``1(System.Collections.Generic.IDictionary{System.String,System.Object},System.String)

Get the value of a corresponding key. If the value is present, ToString is called on the object and System.Json.Text deserialization will be executed on this value.

System.ArgumentNullException:

System.Text.Json.JsonException:

System.NotSupportedException:

MaybeGet``2(System.Collections.Generic.IDictionary{``0,``1},``0)

Get the value of a corresponding key or null of the dictionary does not contain the key.

System.ArgumentNullException:

JsonExtension

Extension to help to work with JSON data

FormatJson(System.String)

Transform a string a formatted JSON string

Newtonsoft.Json.JsonReaderException:

ListResponse`1

The object used to deserialize list response from the Azure DevOps REST API.

Type Parameters

  • T - Type of the resource

Count

The quantity of element

Value

The list of resource

Capacity

TeamMember

HrefObject

An object containing a link

Href

Href or link

System.UriFormatException:

UriInfo

Uri instance of the Href property

IdentityRef

Descriptor

IdentityReference

Descriptor

The descriptor field in the REST response

MemberVelocity

MemberVelocity is the model used to display stat about the velocity of a member.

CapacitySaved

The capacity saved. Normally based on the response of the Capacity REST API.

DisplayName

The name of the member

Equals(obj)

Compare two objects; if it is of type MemberVelocity, the comparer will use only the DisplayName. Otherwise, it is the object.Equals(this, obj) that is going to be called

Name Description
obj System.Object

Returns

GetHashCode

Get the hashcode of the member velocity object.

Returns

HoursOfWorkDone

The hours of work done. Normally calculated from the History according to the member.

RealCapacity

Estimated calculation of the real capacity of a member.

ToString

Return the name of the member velocity instance.

Returns

Updates

List of WorkItemUpdate associate to this member

Sprint

Representation of the sprint resource of the Azure DevOps API

Attributes

The attributes of the sprint. Such as Start Date, Finish Date, and TimeFrame

GetTotalDays

Calculate the number of total days between the Start Date and the FinishDate

Returns

GetTotalWorkingDays(workingDays, teamDaysOff)

Get total working days of a sprint.

Remarks

Ensure to pass non-null reference for each parameter. It will allow the function to do the right calculation. Since each parameter ar consider if they are not null.

Name Description
workingDays System.DayOfWeek[]
List of working days
teamDaysOff Microsoft.TeamFoundation.Work.WebApi.TeamSettingsDaysOff
TeamDaysOff information

Returns

GetTotalDays() - days off

Id

Id of the sprint

Links

Links related to the sprint

Name

Name of the sprint

Path

The Path of the sprint

Url

The Url of the sprint

SprintAttributes

The attributes of a sprint

FinishDate

Finish date

StartDate

Start date

TimeFrame

TimeFrame, current, past.

SprintLinks

Links related to a sprint

Capacity

Link to get capacity information of the sprint

ClassificationNode

The classification node of the sprint

Project

Link of the project of the sprint

Self

Link of the sprint itself

Team

Link of the team

TeamDaysOff

Link to get days off of the sprint

TeamIterations

The link of the iterations

TeamSettings

The team settings link

Workitems

Link to get related work item

WorkItem

Links

WorkItemLinks

Work item links object

Fields

The work item Fields URL

Html

The work item Html URL

Self

The work item URL

WorkItemComments

The work comments URL

WorkItemRevisions

The work item revisions URL

WorkItemType

The work item Type URL

WorkItemUpdates

The work item updates URL

WorkItems

A work item graph

Url

Work item URL

WorkItemRelations

List of related work item

WorkItemUpdate

CompareTo(AzureDevOpsTeamMembersVelocity.Model.WorkItemUpdate)

Compare a WorkItemUpdate base on the RelatedTaskTitle and if the save the RevisedDate

RelatedTaskTitle

The title of the associate WorkItem.

Remarks

Must be managed by the program logic. This data is not in the response of Azure DevOps REST API.

RevisedBy

ErrorModel

ErrorModel code generated by the dotnet new command

OnGet

The OnGet Method of the page

RequestId

ResquestId associate with the error

ShowRequestId

Indicated if RequestId can be shown. (If not NullOrEmpty)

Program

The entry point of the program. It also contains settings to use for System.Text.Json serialization.

CreateHostBuilder(args)

Create the host builder with some default settings

Name Description
args System.String[]
Main method args

Returns

A new HostBuilder

Main(args)

The entry point of the program

Name Description
args System.String[]

SerializerOptions

System.Text.Json SerializerOptions to use in serialization in the app.

DevOpsProxy

DevOpsProxy class is used to call Azure DevOps REST API. Implement rate-limiting and ensure URL validation.

Constructor(client, appSettings, logger)

Constructor with dependencies

Name Description
client System.Net.Http.HttpClient
HttpClient to used
appSettings AzureDevOpsTeamMembersVelocity.TeamMembersVelocitySettings
App settings, to acces AuthenticationHeader
logger Microsoft.Extensions.Logging.ILogger{AzureDevOpsTeamMembersVelocity.Proxy.DevOpsProxy}
Logger to log information and critical error

GetAsync(fullUrl)

Get the body content of a response according to a fullUrl

Name Description
fullUrl System.String
Complete URL of the resource to fetch. Must start with https://dev.azure.com/

Returns

The response body as a string

GetAsync``1(fullUrl)

Get the body content of a response according to a fullUrl

Type Parameters

  • T - Type used in deserialization
Name Description
fullUrl System.String
Complete URL of the resource to fetch. Must start with https://dev.azure.com/

Returns

The response body Deserialized as T

IDevOpsProxy

The interface of to represent an Azure DevOps Proxy

GetAsync(fullUrl)

Get the body of a request as a string.

Name Description
fullUrl System.String
The full URL of the DevOps resource

Returns

The body as a string

GetAsync``1(fullUrl)

Get and deserialize a resource.

Type Parameters

  • T - Type of the resource
Name Description
fullUrl System.String
The full URL of the DevOps resource

Returns

An instance of the response deserialize

AuthUrlPagesProvider

Provider allows to get information about the authentication method used in the app and get basic URL to handle authentication scenario.

Constructor(schema)

Constructor with the authentication schema used.

Name Description
schema System.String
Cookies, Identity.Application, AzureAD, or string.Empty

AuthenticationEnabled

Indicate if the authentication is enabled in the app

IsIdentity

Indicate if the schema is Identity.Application

LoginPage

Return the URL of the login page

LogoutPage

Return the URL to the POST method to log out

Schema

The schema that is used by the application

DevOpsService

Classed used to call and deserialize resource from the Azure DevOps REST API

Constructor(proxy)

Constructor with dependencies

Name Description
proxy AzureDevOpsTeamMembersVelocity.Proxy.IDevOpsProxy
The proxy used to call the REST API

Capacities(capacityUrl)

Get the capacity of a sprint given a full URL

Remarks

api-version 6.0 is used

Name Description
capacityUrl System.String
The full URL of the capacity information.

Returns

The list of capacities

Projects(organization)

Get the list of projects of an organization.

Remarks

See Microsoft doc : https://docs.microsoft.com/en-us/rest/api/azure/devops/core/projects/list?view=azure-devops-rest-6.0

Name Description
organization System.String
Name of the organization. https://dev.azure.com/{organization}

Returns

List of TeamProject

Sprint(sprintUrl)

Get the sprint given a full URL

Remarks

api-version 6.0 is used

Name Description
sprintUrl System.String
The full URL of the sprint.

Returns

The instance of the sprint

Sprints(organization, project, team)

Get the list of sprints of a team.

Name Description
organization System.String
Name of the organisation. https://dev.azure.com/{organisation}
project System.String
team System.String

Returns

TeamDaysOff(teamIterationDaysOffUrl)

Get team days off from the teamIterationDaysOffUrl passed and deserialize the response.

Remarks

The api-version used is 6.0, and the caller is not expected to specify the version in the URL.

Name Description
teamIterationDaysOffUrl System.String
URL of team days off to fetch

Teams(organization, teamProjectId)

Return the list of Teams of an organization TeamProject

Name Description
organization System.String
Name of the organization. https://dev.azure.com/{organization}
teamProjectId System.Guid
Id of the organization team project selected

Returns

List of teams

TeamSettings(teamSettingsUrl)

Get Team Settings given a team settings URL

Remarks

api-version 6.0 is used

Name Description
teamSettingsUrl System.String
The teamSettings full URL without the api-version

Returns

The teamSetting instance

Updates(updatesUrl)

Get the list of updates from the updatesUrl passed and deserialize the response.

Remarks

The api-version used is 6.0, and the caller is not expected to specify the version in the URL.

Name Description
updatesUrl System.String
URL of updates to fetch

WorkItem(workItemUrl)

Get a workItem given a workItemUrl

Name Description
workItemUrl System.String
workItem fullUrl

Returns

The WorkItem deserialized

WorkItems(sprintUrl)

Get the list of work item links given the URL of the sprint.

Name Description
sprintUrl System.String
The URL of the sprint has returned by the DevOpsService.Sprints(System.String,System.String,System.String) method/>

Returns

A work item with details

VelocityService

Service use to aggregate and group history of a sprint

Constructor(devOpsService)

Constructor with dependencies

Name Description
devOpsService AzureDevOpsTeamMembersVelocity.Services.DevOpsService
Instance of DevOpsService use to fetch data needed

GroupByPerson(groupByPerson, workItem, workItemUpdates)

Group the list of updates into the MemberVelocity object associate with the person name

Name Description
groupByPerson System.Collections.Generic.Dictionary{System.String,AzureDevOpsTeamMembersVelocity.Model.MemberVelocity}
Dictionary used to to the group by, can be pre-populated
workItem AzureDevOpsTeamMembersVelocity.Model.WorkItem
Work item
workItemUpdates System.Collections.Generic.List{AzureDevOpsTeamMembersVelocity.Model.WorkItemUpdate}
List of updates to group

MemberVelocities(sprintUrl, capacities, sprint, teamDaysOff, teamSettings)

Asynchronously enumerate each member's velocity. Previously return member also updates if needed at each iteration.

Name Description
sprintUrl System.String
Sprint to analyse
capacities System.Collections.Generic.List{AzureDevOpsTeamMembersVelocity.Model.Capacity}
Capacities informations to enhance result
sprint AzureDevOpsTeamMembersVelocity.Model.Sprint
Sprint information is use to enhance result
teamDaysOff Microsoft.TeamFoundation.Work.WebApi.TeamSettingsDaysOff
Team days off is use to enhance result and do the right calculation
teamSettings Microsoft.TeamFoundation.Work.WebApi.TeamSetting
Team settings is use to enhance result and do the right calculation

Returns

Startup

The startup class uses to build the application.

Constructor(configuration)

The constructor of the startup class with the configuration object in the parameter

Name Description
configuration Microsoft.Extensions.Configuration.IConfiguration

Configuration

Configuration of the app. Use when the AzureAD authentication method is used.

Configure(Microsoft.AspNetCore.Builder.IApplicationBuilder,Microsoft.AspNetCore.Hosting.IWebHostEnvironment,System.IServiceProvider)

This method gets called by the runtime. Use this method to configure the HTTP request pipeline.

ConfigureServices(services)

This method gets called by the runtime. Use this method to add services to the container. For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940

Name Description
services Microsoft.Extensions.DependencyInjection.IServiceCollection

TeamMembersVelocitySettings

This is the main configuration of the app. Those settings can be saved on disk using the persist button on the index.html page.

ApiKey

The ApiKey of the user

AuthenticationHeader

Return the Authentication header object that can be used by assigned this property to the Authorization property of System.Net.Http.HttpClient.DefaultRequestHeaders the Azure DevOps REST API

Organisation

Organization selected

Team

Team selected

TeamProject

Team project selected

TeamProject

Team project resource of the Azure DevOps REST API

Id

Id of the TeamProject

LastUpdateTime

Last time updated

Name

Name of the team project

Revision

Revision of the TeamProject

State

State of the TeamProject

Url

Url of the TeamProject

Visibility

Visibility of the team project

Clone this wiki locally