Skip to main content

Class: License

protoc_gen_openapiv2.options.License

License is a representation of OpenAPI v2 specification's License object.

See: https://github.com/OAI/OpenAPI-Specification/blob/3.0.0/versions/2.0.md#licenseObject

Example:

option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_swagger) = { info: { ... license: { name: "BSD 3-Clause License"; url: "https://github.com/grpc-ecosystem/grpc-gateway/blob/main/LICENSE"; }; ... }; ... };

Implements

Constructors

constructor

new License(properties?): License

Constructs a new License.

Parameters

NameTypeDescription
properties?ILicenseProperties to set

Returns

License

Properties

name

name: string

The license name used for the API.

Implementation of

ILicense.name


url

url: string

A URL to the license used for the API. MUST be in the format of a URL.

Implementation of

ILicense.url

Methods

toJSON

toJSON(): Object

Converts this License to JSON.

Returns

Object

JSON object


create

create(properties?): License

Creates a new License instance using the specified properties.

Parameters

NameTypeDescription
properties?ILicenseProperties to set

Returns

License

License instance


decode

decode(reader, length?): License

Decodes a License message from the specified reader or buffer.

Parameters

NameTypeDescription
readerUint8Array | ReaderReader or buffer to decode from
length?numberMessage length if known beforehand

Returns

License

License

Throws

If the payload is not a reader or valid buffer

Throws

If required fields are missing


decodeDelimited

decodeDelimited(reader): License

Decodes a License message from the specified reader or buffer, length delimited.

Parameters

NameTypeDescription
readerUint8Array | ReaderReader or buffer to decode from

Returns

License

License

Throws

If the payload is not a reader or valid buffer

Throws

If required fields are missing


encode

encode(message, writer?): Writer

Encodes the specified License message. Does not implicitly grpc.gateway.protoc_gen_openapiv2.options.License.verify|verify messages.

Parameters

NameTypeDescription
messageILicenseLicense message or plain object to encode
writer?WriterWriter to encode to

Returns

Writer

Writer


encodeDelimited

encodeDelimited(message, writer?): Writer

Encodes the specified License message, length delimited. Does not implicitly grpc.gateway.protoc_gen_openapiv2.options.License.verify|verify messages.

Parameters

NameTypeDescription
messageILicenseLicense message or plain object to encode
writer?WriterWriter to encode to

Returns

Writer

Writer


fromObject

fromObject(object): License

Creates a License message from a plain object. Also converts values to their respective internal types.

Parameters

NameTypeDescription
objectObjectPlain object

Returns

License

License


getTypeUrl

getTypeUrl(typeUrlPrefix?): string

Gets the default type url for License

Parameters

NameTypeDescription
typeUrlPrefix?stringyour custom typeUrlPrefix(default "type.googleapis.com")

Returns

string

The default type url


toObject

toObject(message, options?): Object

Creates a plain object from a License message. Also converts values to other types if specified.

Parameters

NameTypeDescription
messageLicenseLicense
options?IConversionOptionsConversion options

Returns

Object

Plain object