Skip to content

Comments

Add GetUsageAction#20

Open
DeeJayTC wants to merge 2 commits intobb-io:developfrom
DeeJayTC:main
Open

Add GetUsageAction#20
DeeJayTC wants to merge 2 commits intobb-io:developfrom
DeeJayTC:main

Conversation

@DeeJayTC
Copy link

Added the GetUsageAction which can be used to make sure translate actions can actually be performed based on remaining quota, mostly interesting for free users.


}

[Action("GetUsage", Description = "Get usage information")]
Copy link
Contributor

Choose a reason for hiding this comment

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

Action name should follow the same naming convention as a description. So it should be "Get usage"

{
var result = await Client.GetUsageAsync();
var response = new GetUsageResponse();
if (result.Character != null)
Copy link
Contributor

@bZverok bZverok Feb 1, 2024

Choose a reason for hiding this comment

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

No need to check each property for null and then add it to the response. You can just add all the values with nullchecks, it will be null anyway. Worth adding a constructor to GetUsageResponse

public bool DocumentLimitReached { get; set; }

[Display("Team Documents translated current billing period")]
public long? TeamDocumentCount { get; set; }
Copy link
Contributor

Choose a reason for hiding this comment

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

According to our naming conventions only the first word must start with the capital letter. So it should be "Team documents translated current billing period". Same for other properties

namespace Apps.DeepL.Actions;

[ActionList]
public class GetUsageActionActions : DeepLInvocable
Copy link
Contributor

Choose a reason for hiding this comment

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

Action class is meant to contain actions for a specific entity and not only for one method. So the naming should be like "UsageActions"

Copy link
Contributor

@bZverok bZverok left a comment

Choose a reason for hiding this comment

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

Need to fix namings and building of the response

@bZverok bZverok changed the base branch from main to develop February 7, 2024 11:54
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