Package ca.cdr.test.app.clients
Class NpmPackageClient
java.lang.Object
ca.cdr.test.app.clients.NpmPackageClient
- All Implemented Interfaces:
AutoCloseable
NpmPackageClient is a client for the NPM Package Registry API of the CDR.
It currently supports anonymous and http-basic authentication.
This client provides access to package installation operations through
Smile CDR's package registry endpoint, typically running on port 8002.
-
Method Summary
Modifier and TypeMethodDescriptionstatic NpmPackageClientDeprecated, for removal: This API element is subject to removal in a future version.static NpmPackageClientbuildAnonymous(String theBaseUrl) Deprecated, for removal: This API element is subject to removal in a future version.UseopenAnonymous(String), whose name says that the client owns the connection pool it returns and that the caller has to close it.voidclose()Releases the connection pool this client built for itself.ca.uhn.fhir.jpa.packages.PackageDeleteOutcomeJsondeletePackage(String theName, String theVersion) ca.uhn.fhir.jpa.packages.NpmPackageAssetInfoListJsonfindPackageAssetInfoByUrl(String theFhirVersion, String theCanonicalUrl) ca.uhn.fhir.jpa.packages.PackageInstallationStatusJsongetInstallationStatus(String theJobId) ca.uhn.fhir.jpa.packages.NpmPackageMetadataJsongetPackageMetadata(String theName) ca.uhn.fhir.jpa.packages.PackageInstallOutcomeJsoninstallPackageByParam(String theName, String theVersion, boolean theFetchDependencies, ca.uhn.fhir.jpa.packages.PackageInstallationSpec.InstallModeEnum theInstallMode, ca.uhn.fhir.jpa.packages.PackageInstallationSpec.VersionPolicyEnum theVersionPolicy) ca.uhn.fhir.jpa.packages.PackageInstallOutcomeJsoninstallPackageBySpec(ca.uhn.fhir.jpa.packages.PackageInstallationSpec theSpec) Install a package using the provided specificationca.uhn.fhir.jpa.packages.PackageInstallOutcomeJsoninstallPackageBySpec(String theSpecJson) Install a package using the provided specification as a JSON stringinstallPackageBySpecAsync(ca.uhn.fhir.jpa.packages.PackageInstallationSpec theSpec) static NpmPackageClientissuingOn(SmileTestHttpClient theHttpClient, String theBaseUrl, String theUsername, String thePassword) Builds a client that issues its requests ontheHttpClient, sharing that client's connection pool and cookie store with everything else built over it.static NpmPackageClientOpens a client authenticating as the given user, over a connection pool of its own.static NpmPackageClientopenAnonymous(String theBaseUrl) Opens a client sending no credentials, over a connection pool of its own.ca.uhn.fhir.jpa.packages.NpmPackageSearchResultJsonsearchPackages(org.springframework.util.MultiValueMap<String, String> theQueryParams)
-
Method Details
-
open
@Nonnull public static NpmPackageClient open(@Nonnull String theBaseUrl, @Nonnull String theUsername, @Nonnull String thePassword) Opens a client authenticating as the given user, over a connection pool of its own.The caller owns the pool: open this in a try-with-resources block, or close it from an
@AfterAllwhen it is a field. UseissuingOn(SmileTestHttpClient, String, String, String)instead where a client to issue on already exists.- Parameters:
theBaseUrl- the base URL of the package registrytheUsername- the user to authenticate asthePassword- that user's password
-
openAnonymous
Opens a client sending no credentials, over a connection pool of its own.The caller owns the pool ? see
open(String, String, String).- Parameters:
theBaseUrl- the base URL of the package registry
-
issuingOn
@Nonnull public static NpmPackageClient issuingOn(@Nonnull SmileTestHttpClient theHttpClient, @Nonnull String theBaseUrl, @Nonnull String theUsername, @Nonnull String thePassword) Builds a client that issues its requests ontheHttpClient, sharing that client's connection pool and cookie store with everything else built over it.The pool stays the caller's:
close()leaves it open, so there is nothing here for the caller to release. Useopen(String, String, String)to build a pool of your own.- Parameters:
theHttpClient- the client to issue on, which the caller keeps ownership oftheBaseUrl- the base URL of the package registrytheUsername- the user to authenticate asthePassword- that user's password- See Also:
-
build
@Deprecated(since="2026.11.R01", forRemoval=true) @Nonnull public static NpmPackageClient build(@Nonnull String theBaseUrl, @Nonnull String theUsername, @Nonnull String thePassword) Deprecated, for removal: This API element is subject to removal in a future version.Useopen(String, String, String), whose name says that the client owns the connection pool it returns and that the caller has to close it. -
buildAnonymous
@Deprecated(since="2026.11.R01", forRemoval=true) @Nonnull public static NpmPackageClient buildAnonymous(@Nonnull String theBaseUrl) Deprecated, for removal: This API element is subject to removal in a future version.UseopenAnonymous(String), whose name says that the client owns the connection pool it returns and that the caller has to close it. -
installPackageBySpec
@Nonnull public ca.uhn.fhir.jpa.packages.PackageInstallOutcomeJson installPackageBySpec(ca.uhn.fhir.jpa.packages.PackageInstallationSpec theSpec) Install a package using the provided specification- Parameters:
theSpec- The package installation specification- Returns:
- The installation outcome
-
installPackageBySpec
@Nonnull public ca.uhn.fhir.jpa.packages.PackageInstallOutcomeJson installPackageBySpec(String theSpecJson) Install a package using the provided specification as a JSON string- Parameters:
theSpecJson- The package installation specification as JSON string- Returns:
- The installation outcome
-
installPackageBySpecAsync
@Nonnull public String installPackageBySpecAsync(@Nonnull ca.uhn.fhir.jpa.packages.PackageInstallationSpec theSpec) -
getInstallationStatus
@Nonnull public ca.uhn.fhir.jpa.packages.PackageInstallationStatusJson getInstallationStatus(String theJobId) -
installPackageByParam
@Nonnull public ca.uhn.fhir.jpa.packages.PackageInstallOutcomeJson installPackageByParam(String theName, String theVersion, boolean theFetchDependencies, @Nonnull ca.uhn.fhir.jpa.packages.PackageInstallationSpec.InstallModeEnum theInstallMode, @Nonnull ca.uhn.fhir.jpa.packages.PackageInstallationSpec.VersionPolicyEnum theVersionPolicy) -
deletePackage
@Nonnull public ca.uhn.fhir.jpa.packages.PackageDeleteOutcomeJson deletePackage(String theName, String theVersion) -
searchPackages
@Nonnull public ca.uhn.fhir.jpa.packages.NpmPackageSearchResultJson searchPackages(@Nonnull org.springframework.util.MultiValueMap<String, String> theQueryParams) -
getPackageMetadata
-
findPackageAssetInfoByUrl
@Nonnull public ca.uhn.fhir.jpa.packages.NpmPackageAssetInfoListJson findPackageAssetInfoByUrl(String theFhirVersion, String theCanonicalUrl) -
close
Releases the connection pool this client built for itself. A no-op when the client was built over one supplied by a caller, which owns its own pool.- Specified by:
closein interfaceAutoCloseable
-
open(String, String, String), whose name says that the client owns the connection pool it returns and that the caller has to close it.