-
Notifications
You must be signed in to change notification settings - Fork 271
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
edb0e30
commit a36f822
Showing
14 changed files
with
168 additions
and
101 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,18 +16,21 @@ | |
|
||
package io.apicurio.registry.examples; | ||
|
||
import io.apicurio.registry.client.auth.VertXAuthFactory; | ||
import io.apicurio.registry.rest.client.RegistryClient; | ||
import io.apicurio.registry.rest.client.models.CreateArtifact; | ||
import io.apicurio.registry.rest.client.models.CreateVersion; | ||
import io.apicurio.registry.rest.client.models.IfArtifactExists; | ||
import io.apicurio.registry.rest.client.models.VersionContent; | ||
import io.apicurio.rest.client.util.IoUtil; | ||
import io.kiota.http.vertx.VertXRequestAdapter; | ||
|
||
import java.io.ByteArrayInputStream; | ||
import java.io.File; | ||
import java.io.FileInputStream; | ||
import java.io.InputStream; | ||
import java.nio.charset.StandardCharsets; | ||
|
||
import io.apicurio.registry.client.auth.VertXAuthFactory; | ||
import io.apicurio.registry.rest.client.RegistryClient; | ||
import io.apicurio.registry.rest.client.models.ArtifactContent; | ||
import io.apicurio.rest.client.util.IoUtil; | ||
import io.kiota.http.vertx.VertXRequestAdapter; | ||
|
||
/** | ||
* @author [email protected] | ||
*/ | ||
|
@@ -51,13 +54,16 @@ public static void main(String[] args) throws Exception { | |
String content = template.replaceFirst("Apicurio Registry API", "Apicurio Registry API :: Copy #" + idx); | ||
InputStream contentIS = new ByteArrayInputStream(content.getBytes(StandardCharsets.UTF_8)); | ||
|
||
ArtifactContent artifactContent = new ArtifactContent(); | ||
artifactContent.setContent(IoUtil.toString(contentIS)); | ||
CreateArtifact createArtifact = new CreateArtifact(); | ||
createArtifact.setArtifactId("city"); | ||
createArtifact.setType("JSON"); | ||
createArtifact.setFirstVersion(new CreateVersion()); | ||
createArtifact.getFirstVersion().setContent(new VersionContent()); | ||
createArtifact.getFirstVersion().getContent().setContent(IoUtil.toString(contentIS)); | ||
createArtifact.getFirstVersion().getContent().setContentType("application/json"); | ||
|
||
final io.apicurio.registry.rest.client.models.VersionMetaData amdCity = client.groups().byGroupId("default").artifacts().post(artifactContent, config -> { | ||
config.queryParameters.ifExists = io.apicurio.registry.rest.client.models.IfExists.RETURN_OR_UPDATE; | ||
config.headers.add("X-Registry-ArtifactId", "city"); | ||
config.headers.add("X-Registry-ArtifactType", "JSON"); | ||
client.groups().byGroupId("default").artifacts().post(createArtifact, config -> { | ||
config.queryParameters.ifExists = IfArtifactExists.FIND_OR_CREATE_VERSION; | ||
}); | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.