Skip to content

Conversation

@suyogdaga
Copy link

@suyogdaga suyogdaga commented Apr 7, 2021

Created two new data wrapper classes:

  • ApplicationEndpointWrapper Class
  • IssueEndpointWrapper Class

Issues Endpoint:

  1. Pagination logic
  2. getcountrecords (override base method)

Application Role:

  1. Traditional request based implementation
  2. getcountrecords (override base method)

@suyogdaga suyogdaga requested a review from roehlerw April 7, 2021 18:16
RequestUri = uri,
};
request.Headers.Add(_tokenHeaderName, token);
//request.Headers.Add(_tokenHeaderName, token);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove commented code

public virtual async Task<Count> GetCountOfRecords(IApiClientFactory factory, Settings settings)
{
var response = await factory.CreateApiClient(settings).GetAsync($"{BasePath.TrimEnd('/')}/{AllPath.TrimStart('/')}");
// var response = await factory.CreateApiClient(settings).GetAsync($"{BasePath.TrimEnd('/')}/{AllPath.TrimStart('/')}");
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove commented code

var recordsList = JsonConvert.DeserializeObject<List<ApplicationEndpointWrapper>>(await response.Content.ReadAsStringAsync());


foreach (var item in recordsList){
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

brackets should be like

foreach (...)
{
    ...
}

public long TotalRecords { get; set; }
public long TotalPages { get; set; }
public List<Dictionary<string, object>>? Items { get; set; }

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

extra new line

public string ApiKey { get; set; }
public string Tenant { get; set; }


Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

extra new line

ApiKey = "test123",
Username = "test123",
Tenant = "test123"
ApiKey = "uCkrVYuQ5ZE3GhZoDuDMC48E",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't commit secrets

Assert.Equal(254, records.Count);

var record = JsonConvert.DeserializeObject<Dictionary<string, object>>(records[0].DataJson);
// Assert.Equal("~", record["tilde"]);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove commented code

Assert.Equal(1, records.Count);

var record = JsonConvert.DeserializeObject<Dictionary<string, object>>(records[0].DataJson);
// Assert.Equal("~", record["tilde"]);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed commented code

@suyogdaga suyogdaga requested a review from roehlerw April 8, 2021 19:36
Kind = Count.Types.Kind.Exact,
Value = (int) recordsList.Count()
};

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

extra new line


string projectKey = "DEMO";

var projectKey = "DEMO";
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We will want to generalize this so that the user can get issues for any project, or all projects and not just for DEMO

@suyogdaga suyogdaga requested a review from roehlerw April 8, 2021 21:11
{
Kind = Count.Types.Kind.Exact,
Value = (int) recordsList.Count()
Kind = Count.Types.Kind.Unavailable
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you return unavailable you should not perform any other actions in the count method

public string Username { get; set; }
public string ApiKey { get; set; }
public string Tenant { get; set; }
public string Project { get; set; }
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should make this a List to allow multiple projects to be selected in one connection

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants