The basic idea of the nav builder is to support a chain of method calls that roughly map to the structure and categorisation
of parts of Bitbucket Server. This is referred to as the "Builder API" of navbuilder.
E.g. nav.project('foo').repo('bar').permissions()
will return a builder that can build the URL for the permissions page
of the repository with slug 'bar' of the project with key 'foo', while just nav.project('foo')
will return a builder for a URL to
the project page for project 'foo'.
At each point in the method chain, the returned object will support methods that return a builder
that maps to a concept at a lower level.
At most points, .build()
may be called to build the URL to be used. There are a few places where no URL makes sense.
The "Classes" listed in this module describe the methods that can be called from each step in the chain. E.g.
var adminBuilder = nav.admin(); // adminBuilder will be a bitbucket/util/navbuilder.AdminBuilder
var groupsBuilder = adminBuilder.groups(); // groupsBuilder will be a bitbucket/util/navbuilder.GroupsBuilder
Web Resource: com.atlassian.bitbucket.server.bitbucket-web-api:navbuilder
- Source:
Example
require([
'bitbucket/util/navbuilder',
'bitbucket/util/server'
], function (nav, server) {
server.rest({
url: nav.rest().projects().build()
}).then(doSomethingWithProjects);
});
Classes
- AddonBuilder
- AddonMarketplaceBuilder
- AddonRequestsBuilder
- AdminBuilder
- AdminUsersBuilder
- BranchCompareBuilder
- Builder
- CommitBuilder
- CommitsBuilder
- GettingStartedBuilder
- GlobalRepoBuilder
- GroupsBuilder
- LicenseBuilder
- LoginBuilder
- PermissionBuilder
- PermissionsBuilder
- PluginServletsBuilder
- PluginServletsPathBuilder
- PluginServletsProjectBuilder
- ProjectBuilder
- PullRequestBuilder
- PullRequestDiffBuilder
- PullRequestOverviewBuilder
- Query
- RepoBrowseBuilder
- RepositoryBuilder
- RestAdminBuilder
- RestBuilder
- RestCommitBuilder
- RestCommitPathBuilder
- RestHookBuilder
- RestHookPluginBuilder
- RestHookPluginsBuilder
- RestMarkupBuilder
- RestPermissionAllowBuilder
- RestProfileBuilder
- RestProjectBuilder
- RestProjectPermissionsBuilder
- RestProjectReadPermissionsBuilder
- RestProjectWritePermissionsBuilder
- RestPullRequestBuilder
- RestRawContentBuilder
- RestRecentlyViewedBuilder
- RestRepoCompareBuilder
- RestRepoCompareParamBuilder
- RestRepoFilesListAtBuilder
- RestRepoFilesListBuilder
- RestRepositoryBuilder
- RestUserBuilder
- RevisionSpecifyingBuilder
- SearchBuilder
- SourceTargetBuilder
- TmpBuilder
- Uri
- UserBuilder
- WelcomeBuilder
Members
-
<static, constant> currentProject
-
Returns the project builder for the current page's project, if there is one.
- Deprecated:
- 7.0
- Source:
-
<static, constant> currentPullRequest
-
Returns the builder for the current page's pull request, if there is one.
- Deprecated:
- 7.0
- Source:
-
<static, constant> currentRepo
-
Returns the builder for the current page's repository, if there is one.
- Deprecated:
- 7.0
- Source:
Methods
-
<static> account()
-
- Source:
-
<static> addons() → {bitbucket/util/navbuilder.AddonBuilder}
-
- Source:
Returns:
-
<static> admin() → {bitbucket/util/navbuilder.AdminBuilder}
-
- Source:
Returns:
-
<static> allProjects() → {bitbucket/util/navbuilder.Builder}
-
- Source:
Returns:
-
<static> allRepos() → {bitbucket/util/navbuilder.GlobalRepoBuilder}
-
- Source:
Returns:
-
<static> captcha() → {bitbucket/util/navbuilder.Builder}
-
- Source:
Returns:
-
<static> createProject() → {bitbucket/util/navbuilder.Builder}
-
- Source:
Returns:
-
<static> dashboard() → {bitbucket/util/navbuilder.Builder}
-
- Source:
Returns:
-
<static> gettingStarted() → {bitbucket/util/navbuilder.GettingStartedBuilder}
-
- Source:
Returns:
-
<static> login() → {bitbucket/util/navbuilder.LoginBuilder}
-
- Source:
Returns:
-
<static> newBuilder(components, params) → {bitbucket/util/navbuilder.Builder}
-
Get a raw builder instance to form your own URLs.
Parameters:
Name Type Description components
Array.<string> An array of path components that will be URI encoded and joined by forward slashes when the URL is formed.
params
Object A map of parameter names to values that will form the query string.
- Source:
Returns:
-
<static> parse(uri) → {bitbucket/util/navbuilder.Uri}
-
Parse an absolute string URI in to a mutable Uri object.
Parameters:
Name Type Description uri
string An absolute URI to be parsed.
- Source:
Returns:
-
<static> parseQuery(queryString) → {bitbucket/util/navbuilder.Query}
-
Parse a URI's query string into a mutable object.
Parameters:
Name Type Description queryString
string A query string to be parsed.
- Source:
Returns:
-
<static> pluginServlets() → {bitbucket/util/navbuilder.PluginServletsBuilder}
-
- Source:
Returns:
-
<static> project(projectKey) → {bitbucket/util/navbuilder.ProjectBuilder}
-
Parameters:
Name Type Description projectKey
string The key of the project to return a builder for.
- Source:
Returns:
-
<static> pullRequestShorthand(pullRequest) → {bitbucket/util/navbuilder.RepositoryBuilder}
-
Shorthand for
.project(pullRequest.toRef.repository.project).repository(pullRequest.toRef.repository).pullRequest(pullRequest)
Parameters:
Name Type Description pullRequest
Object The full pull request object
- Source:
Returns:
-
<static> repo(slug) → {bitbucket/util/navbuilder.RepositoryBuilder}
-
Parameters:
Name Type Description slug
string The slug of the repository to return a builder for.
- Source:
Returns:
-
<static> repositoryShorthand(repository) → {bitbucket/util/navbuilder.RepositoryBuilder}
-
Shorthand for
.project(repository.project).repository(repository)
Parameters:
Name Type Description repository
Object The full repository object
- Source:
Returns:
-
<static> rest(resourcePathComponent, version) → {bitbucket/util/navbuilder.RestBuilder}
-
Builds REST URLs (e.g. URLs handled by a
plugin module). This method has some shortcuts to help you build
common URL shapes for your plugin, and also shapes that are used by the Bitbucket Server core REST APIs. For example, to build a
URL like: 'CONTEXT_PATH/my-rest/1.0/projects/PROJ/repos/REPO/pull-requests/1/a/b' while viewing a pull request, useParameters:
Name Type Argument Default Description resourcePathComponent
String <optional>
api The REST module path to build URLs for. The default, "api" points to Bitbucket Server's core REST API path
version
String <optional>
latest The version of the API to reference. Since 3.4
- Source:
Returns:
Example
navbuilder.rest('my-rest', '1.0').currentPullRequest().addPathComponents('a', 'b').build();
-
<static> restHook(hookKey) → {bitbucket/util/navbuilder.RestHookBuilder}
-
Parameters:
Name Type Description hookKey
string The key of the hook you want to build URLs for.
- Source:
Returns:
-
<static> restRawBrowse() → {bitbucket/util/navbuilder.RepoBrowseBuilder}
-
- Source:
Returns:
-
<static> restRepoBrowse() → {bitbucket/util/navbuilder.RepoBrowseBuilder}
-
- Source:
Returns:
-
<static> search() → {bitbucket/util/navbuilder.SearchBuilder}
-
- Source:
Returns:
-
<static> since(since) → {bitbucket/util/navbuilder.Builder}
-
Parameters:
Name Type Argument Description since
string <optional>
The ID of the ref to use as the source of the commit list.
- Source:
Returns:
-
<static> state() → {bitbucket/util/navbuilder.Builder}
-
- Source:
Returns:
-
<static> tmp() → {bitbucket/util/navbuilder.TmpBuilder}
-
- Source:
Returns:
-
<static> user(userOrSlug) → {bitbucket/util/navbuilder.UserBuilder}
-
Parameters:
Name Type Description userOrSlug
The URL-safe slug for a user or a full user object.
- Source:
Returns:
-
<static> welcome() → {bitbucket/util/navbuilder.WelcomeBuilder}
-
- Source:
Returns: