Scope object in SettingsService.this.hookService.getSettings(repository, SettingsService.KEY)

Hi,

in Bitbucket 6.0 this function was removed (Bitbucket Server 5.2
Updated Hooks API
In Bitbucket Server 5.2 we are updating the hooks API to allow hooks to be configured at both a Project and a Repsitory level. Because of this, methods on the RepositoryHookService will now take a Scope object rather than a Repository object to encapsulate the Project or Repository scope to which the settings and enabled/disabled state can be applied. Additionally, in order to make the hooks API more usable, many methods now take ‘request objects’ (e.g. DeleteRepositoryHookRequest, RepositoryHookSearchRequest, SetRepositoryHookSettingsRequest) which is a wrapper around the Scope and other arguments required by the method. For more information on the new API and how to use it, see the Repository Hooks and Merge Checks Guide)

Need help updating the code.

public RepositoryHook getRepositoryHook(final Repository repository) {
try {
return this.securityService.withPermission(Permission.REPO_ADMIN, “Retrieving repository hook”)
.call(new Operation<RepositoryHook, RuntimeException>() {
@Override
public RepositoryHook perform() throws RuntimeException {
return SettingsService.this.hookService.getByKey(repository, SettingsService.KEY);
}
});
} catch (final Exception e) {
LOGGER.error(“Unexpected exception trying to get repository hook”, e);
return null;
}
}

/**

  • Get the webhook settings for the provided repository.
    */
    public Settings getSettings(final Repository repository) {
    try {
    return this.securityService.withPermission(Permission.REPO_ADMIN, “Retrieving settings”)
    .call(new Operation<Settings, RuntimeException>() {
    @Override
    public Settings perform() throws RuntimeException {
    return SettingsService.this.hookService.getSettings(repository, SettingsService.KEY);
    }
    });
    } catch (final Exception e) {
    LOGGER.error(“Unexpected exception trying to get webhook settings”, e);
    return null;
    }
    }

SettingsService.this.hookService.getSettings(repository, SettingsService.KEY); receives a GetRepositoryHookSettingsRequest

and
SettingsService.this.hookService.getByKey(repository, SettingsService.KEY); receives a scope object

how do i update this code? ive check the updated documentaion havent find any reference to how to do it!

thanks

fixed like this: upgrade to 6.0 · TrimbleSolutionsCorporation/TeamcityTriggerHook@c1b8b88 · GitHub