Skip to content

Conversation

@livzorn
Copy link
Contributor

@livzorn livzorn commented Nov 25, 2021

JIRA link

HEEDLS-672
HEEDLS-672

Description

Created the Learning hub Api client and associated view models. Configured user secrets to store the API key, and each developer will have to add it to their user secrets file locally.

Screenshots

None


Developer checks

(Leave tasks unticked if they haven't been appropriate for your ticket.)

I have:

  • Run the formatter and made sure there are no IDE errors.
  • Written tests for the changes (accessibility tests, unit tests for controller, data services, services, view models, etc)
  • Manually tested my work with and without JavaScript. Full manual testing guidelines can be found here: https://softwiretech.atlassian.net/wiki/spaces/HEE/pages/6703648740/Testing
  • Updated/added documentation in Swiki and/or Readme. Links (if any) are below:
  • Updated my Jira ticket with information about other parts of the system that were touched as part of the MR and have to be sanity tested to ensure nothing’s broken.
  • Scanned over my own MR to ensure everything is as expected.

@livzorn livzorn changed the title Heedls 672 Learning Hub API client HEEDLS-672 Learning Hub API client Nov 25, 2021
Copy link
Contributor

@AlexJacksonDS AlexJacksonDS left a comment

Choose a reason for hiding this comment

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

I think there are some improvements that could be made to tidy up the url handling.

return result;
}

private static string GetUrlWithSearchQueryParams(
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm pretty sure there must be a better way to do all this query string construction without using a bunch of string concatenation and interpolation.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I initially used QueryHelpers.AddQueryString to add the query strings, but this method only accepts string values, not StringValues values, so it was impossible to add the query strings dealing with enumerables. Steve suggested I create the query strings manually, but if you can think of a better way, please enlighten me. It does feel a bit icky

@livzorn livzorn force-pushed the HEEDLS-672-learning-hub-api-client branch from 24b9d8f to 03ac5cd Compare November 25, 2021 15:24
Copy link
Contributor

@AlexJacksonDS AlexJacksonDS left a comment

Choose a reason for hiding this comment

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

Might be worth having a chat about/pairing on some ideas to sort out the query strings. I think it certainly should be possible to simplify some of the steps by being a bit smarter about whether we are appending & to the strings or not and making better use of the fact we've got IEnumerables we can use to join/split etc.

Copy link
Contributor

@DanBloxham-sw DanBloxham-sw left a comment

Choose a reason for hiding this comment

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

Looking good overall, just a couple of minor changes.

Comment on lines 64 to 65
public async Task<BulkResourceReference> GetBulkResourcesByReferenceIds(
IEnumerable<int> resourceReferenceIds
Copy link
Contributor

Choose a reason for hiding this comment

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

Given that an empty collection of ints could be passed in, and we know that we will get empty lists backs, we can probably bypass the unnecessary call and just return the model with the empty lists (or maybe null if you think that might be better)

Copy link
Contributor

Choose a reason for hiding this comment

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

We should keep the return type correct (so no null), but I'm not sure whether we should short circuit the API call or not. I kind of feel like the API client should always call the API, and perhaps any calling method should be deciding whether it should call the API or not.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah, that sounds reasonable, it can stay as it is.

@AlexJacksonDS AlexJacksonDS merged commit d2b4175 into master Nov 26, 2021
@AlexJacksonDS AlexJacksonDS deleted the HEEDLS-672-learning-hub-api-client branch November 26, 2021 16:44
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.

5 participants