public interface Api
Modifier and Type | Method and Description |
---|---|
Api |
addModel(Model model)
Add a model to the API.
|
Api |
addModel(java.lang.String name)
Add a new model with blank Schema to the Api.
|
Api |
addModel(java.lang.String name,
com.ibm.broker.rest.schema.Schema schema)
Add a new model with specified Schema to the Api.
|
Resource |
addResource(Resource resource)
Add an existing resource
|
Resource |
addResource(java.lang.String path)
Add a new resource with the specified path.
|
Api |
deleteModel(Model model)
Delete a model from the API.
|
Api |
deleteModel(java.lang.String name)
Delete a model from the API.
|
Api |
deleteResource(java.lang.String path)
Delete an existing resource with the specified path.
|
java.lang.String |
getBasePath()
Get the base path of this API, for example "/myapi/api".
|
java.lang.String |
getBaseURL()
Get the base URL of this API, for example "http://localhost/myapi/api".
|
java.util.List<java.lang.String> |
getConsumesMIMETypes()
Get a list of MIME types (for example application/json) that this API can consume.
|
java.lang.String |
getDescription()
Get the description of this API.
|
java.util.List<DynamicContent> |
getDynamicContent()
Get a list of dynamic content that can be served as supporting documentation for this API.
|
java.lang.String |
getFileName()
Get the name of the file that this API should be saved to.
|
java.lang.String |
getHost()
Get the host that serves this API, for example "localhost".
|
java.lang.String |
getHost(boolean allowDefault)
Get the host that serves this API, for example "localhost".
|
Model |
getModel(java.lang.String name)
Get the model with the specified name.
|
java.util.Map<java.lang.String,java.util.List<com.ibm.broker.rest.schema.SchemaReference>> |
getModelReferences()
Get the modelReferences map.
|
java.util.List<Model> |
getModels()
Get the list of models that are defined by this API.
|
Operation |
getOperation(java.lang.String name)
Get the specified operation provided by this API using its name.
|
java.util.List<Operation> |
getOperations()
Get the list of operations that are provided by this API.
|
int |
getPort()
Get the port that this API is served on, for example "443".
|
java.util.List<java.lang.String> |
getProducesMIMETypes()
Get a list of MIME types (for example application/json) that this API can produce.
|
java.lang.String |
getProtocol()
Get the protocol of this API, for example "https".
|
ApiProvider |
getProvider()
Get the API provider that created or loaded this API.
|
Resource |
getResource(java.lang.String path)
Get the resource with the specified path.
|
java.util.List<Resource> |
getResources()
Get the list of resources that are provided by this API.
|
java.util.List<java.util.List<SecurityRequirement>> |
getSecurityRequirements()
Get a list of security requirements for this API.
|
SecurityScheme |
getSecurityScheme(java.lang.String name)
Get the security scheme with the specified name from this API.
|
java.util.List<SecurityScheme> |
getSecuritySchemes()
Get the list of security schemes that have been defined in this API.
|
java.util.List<StaticContent> |
getStaticContent()
Get a list of static content that can be served as supporting documentation for this API.
|
java.lang.String |
getTitle()
Get the title of this API.
|
java.lang.String |
getVersion()
Get the version of this API, for example "1.0.0".
|
void |
save(java.nio.file.Path file)
Save the API definitions to the specified file.
|
void |
saveToZip(java.util.zip.ZipOutputStream zos,
java.lang.String fileName)
Save the API definitions as new entries to the specified ZIP output
stream.
|
Api |
setBasePath(java.lang.String basePath)
Set the base path of this API, for example "/myapi/api"/
|
Api |
setBaseURL(java.lang.String baseURL)
Set the base URL of this API, for example "http://localhost/myapi/api".
|
Api |
setConsumesMIMETypes(java.util.List<java.lang.String> consumes)
Set the list of MIME types (for example application/json) that this API can consume.
|
Api |
setDescription(java.lang.String description)
Set the description of this API.
|
Api |
setFileName(java.lang.String fileName)
Set the name of the file that this API should be saved to.
|
Api |
setHost(java.lang.String host)
Set the host that serves this API, for example "localhost".
|
Api |
setPort(int port)
Get the port that this API is served on, for example "443".
|
Api |
setProducesMIMETypes(java.util.List<java.lang.String> produces)
Set the list of MIME types (for example application/json) that this API can produce.
|
Api |
setProtocol(java.lang.String protocol)
Set the protocol of this API, for example "https".
|
Api |
setTitle(java.lang.String title)
Set the title of this API.
|
Api |
setVersion(java.lang.String version)
Set the version of this API, for example "1.0.0".
|
java.lang.String |
toString()
Convert this API into a string.
|
java.lang.String |
toString(java.lang.String fileName)
Convert this API into a string.
|
ApiProvider getProvider()
java.lang.String getFileName()
Api setFileName(java.lang.String fileName) throws ApiException
ApiException
- if the file name is not valid for use for this API.java.lang.String getBaseURL()
Api setBaseURL(java.lang.String baseURL) throws ApiException
baseURL
- the new base URL of this API.ApiException
- if the base URL could not be changed.java.lang.String getProtocol()
Api setProtocol(java.lang.String protocol) throws ApiException
protocol
- the new protocol of this API.ApiException
- if the protocol could not be changed.java.lang.String getHost()
java.lang.String getHost(boolean allowDefault)
allowDefault
- if set to false, and the host is not set, then return null.Api setHost(java.lang.String host) throws ApiException
host
- the new host of this API.ApiException
- if the host could not be changed.int getPort()
Api setPort(int port) throws ApiException
port
- the new port of this API.ApiException
- if the port could not be changed.java.lang.String getBasePath()
Api setBasePath(java.lang.String basePath) throws ApiException
basePath
- the new base path of this API.ApiException
- if the base path could not be changed.java.lang.String getTitle()
Api setTitle(java.lang.String title) throws ApiException
title
- the new title of this API.ApiException
- if the title could not be changed.java.lang.String getDescription()
Api setDescription(java.lang.String description) throws ApiException
description
- the new description of this API.ApiException
- if the description could not be changed.java.lang.String getVersion()
Api setVersion(java.lang.String version) throws ApiException
version
- the new version of this API.ApiException
- if the version could not be changed.java.util.List<Model> getModels()
Model getModel(java.lang.String name) throws ApiException
name
- the name of the model.ApiException
- if no model with the specified name exists.Api addModel(java.lang.String name, com.ibm.broker.rest.schema.Schema schema) throws ApiException
name
- the desired name of the new model.schema
- the desired Schema of the new model.ApiException
Api addModel(java.lang.String name) throws ApiException
name
- the desired name of the new model.ApiException
Api addModel(Model model) throws ApiException
model
- the model to add.ApiException
Api deleteModel(java.lang.String name) throws ApiException
name
- the name of the model to delete.ApiException
Api deleteModel(Model model) throws ApiException
model
- the model to delete.ApiException
java.util.List<Resource> getResources()
Resource getResource(java.lang.String path) throws ApiException
path
- the path of the resource.ApiException
- if no resource with the specified path exists.Resource addResource(java.lang.String path) throws ApiException
path
- the path of the resource.ApiException
- if the new resource could not be added.Resource addResource(Resource resource) throws ApiException
resource
- - the resource.ApiException
- if the resource could not be added.Api deleteResource(java.lang.String path) throws ApiException
path
- the path of the resource.ApiException
- if the existing resource could not be deleted.java.util.List<Operation> getOperations()
Operation getOperation(java.lang.String name) throws ApiException
name
- the name of the operation.ApiException
- if the specified operation does not exist.java.lang.String toString()
toString
in class java.lang.Object
java.lang.String toString(java.lang.String fileName) throws ApiException
fileName
- specify a file name that the returned string should be suitable for saving to.ApiException
- if the API cannot be converted into a string suitable for saving to the specified file name.void save(java.nio.file.Path file) throws ApiException
file
- the file to save the API definitions to.ApiException
- if an error occurs saving the API definitions.void saveToZip(java.util.zip.ZipOutputStream zos, java.lang.String fileName) throws ApiException
zos
- the ZIP output stream to save the API definitions to.fileName
- the file to save the API definitions to in the ZIP output stream.ApiException
- if an error occurs saving the API definitions.java.util.Map<java.lang.String,java.util.List<com.ibm.broker.rest.schema.SchemaReference>> getModelReferences() throws ApiException
ApiException
java.util.List<StaticContent> getStaticContent() throws ApiException
ApiException
java.util.List<DynamicContent> getDynamicContent() throws ApiException
ApiException
java.util.List<java.lang.String> getConsumesMIMETypes()
Api setConsumesMIMETypes(java.util.List<java.lang.String> consumes) throws ApiException
consumes
- the list of MIME types that this API can consume, or null to clear the list.ApiException
- if the list could not be set.java.util.List<java.lang.String> getProducesMIMETypes()
Api setProducesMIMETypes(java.util.List<java.lang.String> produces) throws ApiException
produces
- the list of MIME types that this API can produce, or null to clear the list.ApiException
- if the list could not be set.java.util.List<SecurityScheme> getSecuritySchemes()
SecurityScheme getSecurityScheme(java.lang.String name) throws ApiException
name
- the name of the security scheme.ApiException
- if no security scheme exists with the specified name.java.util.List<java.util.List<SecurityRequirement>> getSecurityRequirements()