Skip to content

Commit a69ea47

Browse files
authored
Comment for model (#471)
(WIP) depends on the previous PR #469 This change provides YARD with sufficient information about the models(classes). Many of the comments created are the same as the types in RBS, as well as existing descriptions and variable names. Since YARD uses a different notation than RBS, you can consider this as an adaptation to that notation, and there should be almost no issues.
1 parent fcaa790 commit a69ea47

265 files changed

Lines changed: 3559 additions & 607 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

generator/src/main/resources/line-bot-sdk-ruby-generator/model.pebble

Lines changed: 42 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,50 @@ module Line
2121
# @see {{ model.model.externalDocumentation.url }}
2222
{% endif -%}
2323
class {{ model.model.classname }}{% if model.model.parent != null %} < {{ model.model.parent }}{% endif %}
24-
{%- for property in model.model.vars %}
25-
{% if model.model.vendorExtensions.get("x-selector").propertyName != property.name %}attr_accessor{% else %}attr_reader{% endif %} :{{ property.name }}{% if property.description != null %} # {{ property.description }}{% endif %}
24+
{%- for variable in model.model.vars %}
25+
# @!attribute [{% if model.model.vendorExtensions.get("x-selector").propertyName != variable.name %}rw{% else %}r{% endif %}] {{ variable.name }}
26+
{% if variable.openApiType == 'array' -%}
27+
{% if variable.items.isModel -%}
28+
# @return [{{ "Array[#{variable.items.openApiType}]" }}{% if not variable.required %},nil{% endif -%}] {{ variable.description }}
29+
{% elseif variable.items.allowableValues != null -%}
30+
# @return [Array[{% for value in variable.items.allowableValues.values %}'{{ value }}'{{ loop.last ? '' : '|' }}{% endfor -%}]] {{ variable.description }}
31+
{% else -%}
32+
# @return [{{ variable.items.openApiType ? "Array[#{typeMapping[variable.items.openApiType]}]" : 'Array[untyped]' }}{% if not variable.required %},nil{% endif -%}] {{ variable.description }}
33+
{% endif -%}
34+
{% elseif variable.isModel -%}
35+
# @return [{{ variable.openApiType }}{% if not variable.required %},nil{% endif -%}] {{ variable.description }}
36+
{% else -%}
37+
{% if variable.allowableValues != null -%}
38+
# @return [String{% if not variable.required %},nil{% endif -%}] ({% for value in variable.allowableValues.values %}'{{ value }}'{{ loop.last ? '' : '|' }}{% endfor %}) {{ variable.description }}
39+
{% else -%}
40+
# @return [{{ typeMapping[variable.openApiType] ? typeMapping[variable.openApiType] : 'untyped' }}{% if not variable.required %},nil{% endif -%}] {{ variable.description }}
41+
{% endif -%}
42+
{% endif -%}
43+
{% if model.model.vendorExtensions.get("x-selector").propertyName != variable.name %}attr_accessor{% else %}attr_reader{% endif %} :{{ variable.name }}
2644
{%- endfor %}
2745

46+
{# @param #}
47+
{%- for variable in model.model.vars -%}
48+
{% if model.model.vendorExtensions.get("x-selector").propertyName != variable.name -%}
49+
{% if variable.openApiType == 'array' -%}
50+
{% if variable.items.isModel -%}
51+
# @param {{ variable.name }} [{{ "Array[#{variable.items.openApiType}]" }}{% if not variable.required %},nil{% endif -%}] {{ variable.description }}
52+
{% elseif variable.items.allowableValues != null -%}
53+
# @param {{ variable.name }} [Array[{% for value in variable.items.allowableValues.values %}'{{ value }}'{{ loop.last ? '' : '|' }}{% endfor -%}]{% if not variable.required %},nil{% endif -%}] {{ variable.description }}
54+
{% else -%}
55+
# @param {{ variable.name }} [{{ variable.items.openApiType ? "Array[#{typeMapping[variable.items.openApiType]}]" : 'Array[untyped]' }}{% if not variable.required %},nil{% endif -%}] {{ variable.description }}
56+
{% endif -%}
57+
{% elseif variable.isModel -%}
58+
# @param {{ variable.name }} [{{ variable.openApiType }}{% if not variable.required %},nil{% endif -%}] {{ variable.description }}
59+
{% else -%}
60+
{% if variable.allowableValues != null -%}
61+
# @param {{ variable.name }} [String{% if not variable.required %},nil{% endif -%}] ({% for value in variable.allowableValues.values %}'{{ value }}'{{ loop.last ? '' : '|' }}{% endfor %}) {{ variable.description }}
62+
{% else -%}
63+
# @param {{ variable.name }} [{{ typeMapping[variable.openApiType] ? typeMapping[variable.openApiType] : 'untyped' }}{% if not variable.required %},nil{% endif -%}] {{ variable.description }}
64+
{% endif -%}
65+
{% endif -%}
66+
{% endif -%}
67+
{% endfor -%}
2868
def initialize({% for property in model.model.vars %}{% if model.model.vendorExtensions.get("x-selector").propertyName != property.name %}
2969
{{ property.name }}:{% if property.defaultValue == null %}{{ property.required ? '' : ' nil' }}{% else %}{{ ' ' + property.defaultValue }}{% endif %},{% endif %}{% endfor %}
3070
**dynamic_attributes

lib/line/bot/v2/channel_access_token/model/channel_access_token_key_ids_response.rb

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,11 @@ module ChannelAccessToken
1414
# Channel access token key IDs
1515
# @see https://developers.line.biz/en/reference/messaging-api/#get-all-valid-channel-access-token-key-ids-v2-1
1616
class ChannelAccessTokenKeyIdsResponse
17-
attr_accessor :kids # Array of channel access token key IDs.
17+
# @!attribute [rw] kids
18+
# @return [Array[String]] Array of channel access token key IDs.
19+
attr_accessor :kids
1820

21+
# @param kids [Array[String]] Array of channel access token key IDs.
1922
def initialize(
2023
kids:,
2124
**dynamic_attributes

lib/line/bot/v2/channel_access_token/model/error_response.rb

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,15 @@ module V2
1313
module ChannelAccessToken
1414
# Error response of the Channel access token
1515
class ErrorResponse
16-
attr_accessor :error # Error summary
17-
attr_accessor :error_description # Details of the error. Not returned in certain situations.
16+
# @!attribute [rw] error
17+
# @return [String,nil] Error summary
18+
attr_accessor :error
19+
# @!attribute [rw] error_description
20+
# @return [String,nil] Details of the error. Not returned in certain situations.
21+
attr_accessor :error_description
1822

23+
# @param error [String,nil] Error summary
24+
# @param error_description [String,nil] Details of the error. Not returned in certain situations.
1925
def initialize(
2026
error: nil,
2127
error_description: nil,

lib/line/bot/v2/channel_access_token/model/issue_channel_access_token_response.rb

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,23 @@ module ChannelAccessToken
1414
# Issued channel access token
1515
# @see https://developers.line.biz/en/reference/messaging-api/#issue-channel-access-token-v2-1
1616
class IssueChannelAccessTokenResponse
17-
attr_accessor :access_token # Channel access token.
18-
attr_accessor :expires_in # Amount of time in seconds from issue to expiration of the channel access token
19-
attr_accessor :token_type # A token type.
20-
attr_accessor :key_id # Unique key ID for identifying the channel access token.
17+
# @!attribute [rw] access_token
18+
# @return [String] Channel access token.
19+
attr_accessor :access_token
20+
# @!attribute [rw] expires_in
21+
# @return [Integer] Amount of time in seconds from issue to expiration of the channel access token
22+
attr_accessor :expires_in
23+
# @!attribute [rw] token_type
24+
# @return [String] A token type.
25+
attr_accessor :token_type
26+
# @!attribute [rw] key_id
27+
# @return [String] Unique key ID for identifying the channel access token.
28+
attr_accessor :key_id
2129

30+
# @param access_token [String] Channel access token.
31+
# @param expires_in [Integer] Amount of time in seconds from issue to expiration of the channel access token
32+
# @param token_type [String] A token type.
33+
# @param key_id [String] Unique key ID for identifying the channel access token.
2234
def initialize(
2335
access_token:,
2436
expires_in:,

lib/line/bot/v2/channel_access_token/model/issue_short_lived_channel_access_token_response.rb

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,19 @@ module ChannelAccessToken
1414
# Issued short-lived channel access token
1515
# @see https://developers.line.biz/en/reference/messaging-api/#issue-shortlived-channel-access-token
1616
class IssueShortLivedChannelAccessTokenResponse
17-
attr_accessor :access_token # A short-lived channel access token. Valid for 30 days. Note: Channel access tokens cannot be refreshed.
18-
attr_accessor :expires_in # Time until channel access token expires in seconds from time the token is issued.
19-
attr_accessor :token_type # Token type. The value is always `Bearer`.
17+
# @!attribute [rw] access_token
18+
# @return [String] A short-lived channel access token. Valid for 30 days. Note: Channel access tokens cannot be refreshed.
19+
attr_accessor :access_token
20+
# @!attribute [rw] expires_in
21+
# @return [Integer] Time until channel access token expires in seconds from time the token is issued.
22+
attr_accessor :expires_in
23+
# @!attribute [rw] token_type
24+
# @return [String] Token type. The value is always `Bearer`.
25+
attr_accessor :token_type
2026

27+
# @param access_token [String] A short-lived channel access token. Valid for 30 days. Note: Channel access tokens cannot be refreshed.
28+
# @param expires_in [Integer] Time until channel access token expires in seconds from time the token is issued.
29+
# @param token_type [String] Token type. The value is always `Bearer`.
2130
def initialize(
2231
access_token:,
2332
expires_in:,

lib/line/bot/v2/channel_access_token/model/issue_stateless_channel_access_token_response.rb

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,19 @@ module ChannelAccessToken
1414
# Issued stateless channel access token
1515
# @see https://developers.line.biz/en/reference/messaging-api/#issue-stateless-channel-access-token
1616
class IssueStatelessChannelAccessTokenResponse
17-
attr_accessor :access_token # A stateless channel access token. The token is an opaque string which means its format is an implementation detail and the consumer of this token should never try to use the data parsed from the token.
18-
attr_accessor :expires_in # Duration in seconds after which the issued access token expires
19-
attr_accessor :token_type # Token type. The value is always `Bearer`.
17+
# @!attribute [rw] access_token
18+
# @return [String] A stateless channel access token. The token is an opaque string which means its format is an implementation detail and the consumer of this token should never try to use the data parsed from the token.
19+
attr_accessor :access_token
20+
# @!attribute [rw] expires_in
21+
# @return [Integer] Duration in seconds after which the issued access token expires
22+
attr_accessor :expires_in
23+
# @!attribute [rw] token_type
24+
# @return [String] Token type. The value is always `Bearer`.
25+
attr_accessor :token_type
2026

27+
# @param access_token [String] A stateless channel access token. The token is an opaque string which means its format is an implementation detail and the consumer of this token should never try to use the data parsed from the token.
28+
# @param expires_in [Integer] Duration in seconds after which the issued access token expires
29+
# @param token_type [String] Token type. The value is always `Bearer`.
2130
def initialize(
2231
access_token:,
2332
expires_in:,

lib/line/bot/v2/channel_access_token/model/verify_channel_access_token_response.rb

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,19 @@ module V2
1313
module ChannelAccessToken
1414
# Verification result
1515
class VerifyChannelAccessTokenResponse
16-
attr_accessor :client_id # The channel ID for which the channel access token was issued.
17-
attr_accessor :expires_in # Number of seconds before the channel access token expires.
18-
attr_accessor :scope # Permissions granted to the channel access token.
16+
# @!attribute [rw] client_id
17+
# @return [String] The channel ID for which the channel access token was issued.
18+
attr_accessor :client_id
19+
# @!attribute [rw] expires_in
20+
# @return [Integer] Number of seconds before the channel access token expires.
21+
attr_accessor :expires_in
22+
# @!attribute [rw] scope
23+
# @return [String,nil] Permissions granted to the channel access token.
24+
attr_accessor :scope
1925

26+
# @param client_id [String] The channel ID for which the channel access token was issued.
27+
# @param expires_in [Integer] Number of seconds before the channel access token expires.
28+
# @param scope [String,nil] Permissions granted to the channel access token.
2029
def initialize(
2130
client_id:,
2231
expires_in:,

lib/line/bot/v2/insight/model/age_tile.rb

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,15 @@ module Bot
1212
module V2
1313
module Insight
1414
class AgeTile
15-
attr_accessor :age # users' age
16-
attr_accessor :percentage # Percentage
15+
# @!attribute [rw] age
16+
# @return [String,nil] ('from0to14'|'from15to19'|'from20to24'|'from25to29'|'from30to34'|'from35to39'|'from40to44'|'from45to49'|'from50'|'from50to54'|'from55to59'|'from60to64'|'from65to69'|'from70'|'unknown') users' age
17+
attr_accessor :age
18+
# @!attribute [rw] percentage
19+
# @return [Float,nil] Percentage
20+
attr_accessor :percentage
1721

22+
# @param age [String,nil] ('from0to14'|'from15to19'|'from20to24'|'from25to29'|'from30to34'|'from35to39'|'from40to44'|'from45to49'|'from50'|'from50to54'|'from55to59'|'from60to64'|'from65to69'|'from70'|'unknown') users' age
23+
# @param percentage [Float,nil] Percentage
1824
def initialize(
1925
age: nil,
2026
percentage: nil,

lib/line/bot/v2/insight/model/app_type_tile.rb

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,15 @@ module Bot
1212
module V2
1313
module Insight
1414
class AppTypeTile
15-
attr_accessor :app_type # users' OS
16-
attr_accessor :percentage # Percentage
15+
# @!attribute [rw] app_type
16+
# @return [String,nil] ('ios'|'android'|'others') users' OS
17+
attr_accessor :app_type
18+
# @!attribute [rw] percentage
19+
# @return [Float,nil] Percentage
20+
attr_accessor :percentage
1721

22+
# @param app_type [String,nil] ('ios'|'android'|'others') users' OS
23+
# @param percentage [Float,nil] Percentage
1824
def initialize(
1925
app_type: nil,
2026
percentage: nil,

lib/line/bot/v2/insight/model/area_tile.rb

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,15 @@ module Bot
1212
module V2
1313
module Insight
1414
class AreaTile
15-
attr_accessor :area # users' country and region
16-
attr_accessor :percentage # Percentage
15+
# @!attribute [rw] area
16+
# @return [String,nil] users' country and region
17+
attr_accessor :area
18+
# @!attribute [rw] percentage
19+
# @return [Float,nil] Percentage
20+
attr_accessor :percentage
1721

22+
# @param area [String,nil] users' country and region
23+
# @param percentage [Float,nil] Percentage
1824
def initialize(
1925
area: nil,
2026
percentage: nil,

0 commit comments

Comments
 (0)