Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create StatisticsClient class #16

Merged
merged 1 commit into from
Oct 29, 2019
Merged

Create StatisticsClient class #16

merged 1 commit into from
Oct 29, 2019

Conversation

AndriyShevchuk
Copy link
Contributor

@AndriyShevchuk AndriyShevchuk commented Oct 25, 2019

Create StatisticsClient class, add constructor and unit-tests
Add getSummary method to fetch summary data from CoverageApi
Create SummaryRequest class to add parameters to the getSummary method

Resolves: OLPEDGE-939, OLPEDGE-940
Signed-off-by: ashevchu [email protected]

export class StatisticsClient {
public readonly context: DataStoreContext;

constructor(context: DataStoreContext) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can we use like this: constructor(private readonly context: DataStoreContext) { } ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed

@@ -0,0 +1,31 @@
import { DataStoreContext } from "./DataStoreContext";
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please, move after Licence

Copy link
Contributor Author

Choose a reason for hiding this comment

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

moved

*/
export class StatisticsClient {
constructor(private readonly context: DataStoreContext) {
this.context = context;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please, remove this.context = context;

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

return Promise.reject(new Error(`No layerId provided`));
}
const coverageRequestBuilder = await this.getRequestBuilder(summaryRequest.catalogHrn)
.catch(error => error);
Copy link
Collaborator

Choose a reason for hiding this comment

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

.catch(error => error); Maybe should be returned Promise.reject from getSummary ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed

}).catch(this.errorHandler);
}

private async errorHandler(error: any) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

could you please not use any?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed

private _catalogHrn: string | undefined;
private _layerId: string | undefined;

get catalogHrn(): string | undefined {
Copy link
Collaborator

Choose a reason for hiding this comment

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

could you please use getCatalogHrn() to align with C++?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

get layerId(): string | undefined {
return this._layerId;
}
set layerId(layerId: string | undefined) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

We don't need this setter? we have withLayerId

Copy link
Contributor Author

Choose a reason for hiding this comment

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

removed

@AndriyShevchuk AndriyShevchuk force-pushed the task/olpedge-939 branch 2 times, most recently from 4505d3c to f772d38 Compare October 29, 2019 10:16
Create StatisticsClient class, add constructor and unit-tests
Add getSummary method to fetch summary data from CoverageApi
Create SummaryRequest class to add parameters to the getSummary method

Resolves: OLPEDGE-939, OLPEDGE-940
Signed-off-by: ashevchu <[email protected]>
@OleksiiZubko OleksiiZubko merged commit e137a5d into master Oct 29, 2019
@OleksiiZubko OleksiiZubko deleted the task/olpedge-939 branch October 29, 2019 10:47
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.

None yet

2 participants