refactor: clean up the getAccountID function sig

The getAccountID function no longer needs the path to the credentials
file.
This commit is contained in:
Dan Anglin 2024-08-13 23:51:16 +01:00
parent 878a898d4c
commit a0eab3b6ae
Signed by: dananglin
GPG key ID: 0C1D44CFBEE68638
12 changed files with 12 additions and 13 deletions

View file

@ -25,7 +25,7 @@ func (a *AcceptExecutor) Execute() error {
}
func (a *AcceptExecutor) acceptFollowRequest(gtsClient *client.Client) error {
accountID, err := getAccountID(gtsClient, false, a.accountName, a.config.CredentialsFile)
accountID, err := getAccountID(gtsClient, false, a.accountName)
if err != nil {
return fmt.Errorf("received an error while getting the account ID: %w", err)
}

View file

@ -12,7 +12,6 @@ func getAccountID(
gtsClient *client.Client,
myAccount bool,
accountNames internalFlag.StringSliceValue,
credentialsFile string,
) (string, error) {
account, err := getAccount(gtsClient, myAccount, accountNames)
if err != nil {

View file

@ -104,7 +104,7 @@ func (a *AddExecutor) addToAccount(gtsClient *client.Client) error {
}
func (a *AddExecutor) addNoteToAccount(gtsClient *client.Client) error {
accountID, err := getAccountID(gtsClient, false, a.accountNames, a.config.CredentialsFile)
accountID, err := getAccountID(gtsClient, false, a.accountNames)
if err != nil {
return fmt.Errorf("received an error while getting the account ID: %w", err)
}

View file

@ -25,7 +25,7 @@ func (b *BlockExecutor) Execute() error {
}
func (b *BlockExecutor) blockAccount(gtsClient *client.Client) error {
accountID, err := getAccountID(gtsClient, false, b.accountName, b.config.CredentialsFile)
accountID, err := getAccountID(gtsClient, false, b.accountName)
if err != nil {
return fmt.Errorf("received an error while getting the account ID: %w", err)
}

View file

@ -25,7 +25,7 @@ func (f *FollowExecutor) Execute() error {
}
func (f *FollowExecutor) followAccount(gtsClient *client.Client) error {
accountID, err := getAccountID(gtsClient, false, f.accountName, f.config.CredentialsFile)
accountID, err := getAccountID(gtsClient, false, f.accountName)
if err != nil {
return fmt.Errorf("received an error while getting the account ID: %w", err)
}

View file

@ -25,7 +25,7 @@ func (m *MuteExecutor) Execute() error {
}
func (m *MuteExecutor) muteAccount(gtsClient *client.Client) error {
accountID, err := getAccountID(gtsClient, false, m.accountName, m.config.CredentialsFile)
accountID, err := getAccountID(gtsClient, false, m.accountName)
if err != nil {
return fmt.Errorf("received an error while getting the account ID: %w", err)
}

View file

@ -25,7 +25,7 @@ func (r *RejectExecutor) Execute() error {
}
func (r *RejectExecutor) rejectFollowRequest(gtsClient *client.Client) error {
accountID, err := getAccountID(gtsClient, false, r.accountName, r.config.CredentialsFile)
accountID, err := getAccountID(gtsClient, false, r.accountName)
if err != nil {
return fmt.Errorf("received an error while getting the account ID: %w", err)
}

View file

@ -93,7 +93,7 @@ func (r *RemoveExecutor) removeFromAccount(gtsClient *client.Client) error {
}
func (r *RemoveExecutor) removeNoteFromAccount(gtsClient *client.Client) error {
accountID, err := getAccountID(gtsClient, false, r.accountNames, r.config.CredentialsFile)
accountID, err := getAccountID(gtsClient, false, r.accountNames)
if err != nil {
return fmt.Errorf("received an error while getting the account ID: %w", err)
}

View file

@ -253,7 +253,7 @@ func (s *ShowExecutor) showFollowers(gtsClient *client.Client) error {
}
func (s *ShowExecutor) showFollowersFromAccount(gtsClient *client.Client) error {
accountID, err := getAccountID(gtsClient, s.myAccount, s.accountName, s.config.CredentialsFile)
accountID, err := getAccountID(gtsClient, s.myAccount, s.accountName)
if err != nil {
return fmt.Errorf("received an error while getting the account ID: %w", err)
}
@ -293,7 +293,7 @@ func (s *ShowExecutor) showFollowing(gtsClient *client.Client) error {
}
func (s *ShowExecutor) showFollowingFromAccount(gtsClient *client.Client) error {
accountID, err := getAccountID(gtsClient, s.myAccount, s.accountName, s.config.CredentialsFile)
accountID, err := getAccountID(gtsClient, s.myAccount, s.accountName)
if err != nil {
return fmt.Errorf("received an error while getting the account ID: %w", err)
}

View file

@ -25,7 +25,7 @@ func (b *UnblockExecutor) Execute() error {
}
func (b *UnblockExecutor) unblockAccount(gtsClient *client.Client) error {
accountID, err := getAccountID(gtsClient, false, b.accountName, b.config.CredentialsFile)
accountID, err := getAccountID(gtsClient, false, b.accountName)
if err != nil {
return fmt.Errorf("received an error while getting the account ID: %w", err)
}

View file

@ -25,7 +25,7 @@ func (f *UnfollowExecutor) Execute() error {
}
func (f *UnfollowExecutor) unfollowAccount(gtsClient *client.Client) error {
accountID, err := getAccountID(gtsClient, false, f.accountName, f.config.CredentialsFile)
accountID, err := getAccountID(gtsClient, false, f.accountName)
if err != nil {
return fmt.Errorf("received an error while getting the account ID: %w", err)
}

View file

@ -25,7 +25,7 @@ func (m *UnmuteExecutor) Execute() error {
}
func (m *UnmuteExecutor) unmuteAccount(gtsClient *client.Client) error {
accountID, err := getAccountID(gtsClient, false, m.accountName, m.config.CredentialsFile)
accountID, err := getAccountID(gtsClient, false, m.accountName)
if err != nil {
return fmt.Errorf("received an error while getting the account ID: %w", err)
}