Skip to content

Commit 826c9f4

Browse files
authored
Sync comment between code and rbs (line#556)
Resolve line#534 When jumping to RBS in the IDE, there are few comments. Having comments would be helpful. It doesn't have to be YARD; RDoc might be preferable, but having information is the priority. This change synchronizes with the code comments. There are no other changes.
1 parent ffb2b20 commit 826c9f4

File tree

537 files changed

+4985
-302
lines changed

Some content is hidden

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

537 files changed

+4985
-302
lines changed

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,9 @@ module Line
104104
end
105105
end
106106

107+
# Create an instance of the class from a hash
108+
# @param args [Hash] Hash containing all the required attributes
109+
# @return [Line::Bot::V2::{{ packageName | camelize }}::{{ model.model.classname }}] Instance of the class
107110
def self.create(args) # steep:ignore
108111
{%- if model.model.vendorExtensions.get("x-children") != null and model.model.vendorExtensions.get("x-discriminator-property") != null %}
109112
klass = detect_class(type: args[:{{ model.model.vendorExtensions.get("x-discriminator-property") }}])

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

Lines changed: 53 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,33 @@ module Line
99
module {{ packageName | camelize }}
1010
class Api{{ operations.classname.indexOf('Blob') != -1 ? 'Blob' : '' }}Client
1111
@http_client: HttpClient
12+
# Initializes a new {Line::Bot::V2::{{ packageName | camelize }}::Api{{ operations.classname.indexOf('Blob') != -1 ? 'Blob' : '' }}Client} instance.
13+
#
14+
# @param base_url [String] The base URL for requests (optional).
15+
# Defaults to '{{endpoint(operations.classname)}}' if none is provided.
16+
# You can override this for testing or to use a mock server.
17+
{%- if packageName == 'module_attach' %}
18+
# @param channel_id [String] The channel ID for Basic authentication.
19+
# @param channel_secret [String] The channel secret for Basic authentication.
20+
{%- elseif packageName != 'channel_access_token' %}
21+
# @param channel_access_token [String] The channel access token for authorization.
22+
{%- endif %}
23+
# @param http_options [Hash] HTTP options (same as Net::HTTP options).
24+
# See: https://docs.ruby-lang.org/en/3.4/Net/HTTP.html to understand the options.
25+
#
26+
# @example
27+
# @client ||= Line::Bot::V2::{{ packageName | camelize }}::Api{{ operations.classname.indexOf('Blob') != -1 ? 'Blob' : '' }}Client.new(
28+
{%- if packageName == 'module_attach' %}
29+
# channel_id: "YOUR_CHANNEL_ID",
30+
# channel_secret: "YOUR_CHANNEL_SECRET",
31+
{%- elseif packageName != 'channel_access_token' %}
32+
# channel_access_token: "YOUR_CHANNEL_ACCESS_TOKEN",
33+
{%- endif %}
34+
# http_options: {
35+
# open_timeout: 5,
36+
# read_timeout: 5,
37+
# }
38+
# )
1239
def initialize: (
1340
?base_url: String?
1441
{%- if packageName == 'channel_access_token' -%}
@@ -23,19 +50,29 @@ module Line
2350
{%- for op in operations.operation %}
2451

2552
# {{ op.notes }}
53+
# This requests to <code>{{ op.httpMethod }} {{ endpoint(operations.classname) }}{{ op.path }}</code>
54+
# This returns an array containing response, HTTP status code, and header in order. Please specify all header keys in lowercase.
2655
#
2756
{% for param in op.allParams -%}
28-
# @param {{ param.paramName }} {{ param.description }}
57+
# @param {{param.paramName}} [{{ param.dataType }}{{ param.required ? '' : ', nil' }}] {{param.description}}
2958
{% endfor -%}
3059
{% if op.isDeprecated -%}
31-
# @deprecated
60+
# @deprecated
3261
{% endif -%}
3362
{% if op.externalDocs.description != null -%}
3463
# {{op.externalDocs.description}}
3564
{% endif -%}
3665
{% if op.externalDocs.url != null -%}
3766
# @see {{op.externalDocs.url}}
38-
{% endif -%}
67+
{%- endif %}
68+
{%- for response in op.responses %}
69+
{%- if response.content['application/json'].schema.complexType != null %}
70+
# @return [Array(Line::Bot::V2::{{ packageName | camelize }}::{{ response.content['application/json'].schema.complexType }}, Integer, Hash{String => String})] when HTTP status code is {{ response.code }}
71+
{%- else %}
72+
# @return [Array((String|nil), Integer, Hash{String => String})] when HTTP status code is {{ response.code }}
73+
{%- endif %}
74+
{%- endfor %}
75+
# @return [Array((String|nil), Integer, Hash{String => String})] when other HTTP status code is returned. String is HTTP response body itself.
3976
def {{op.nickname}}_with_http_info: (
4077
{%- for param in op.allParams %}
4178
{{ param.required ? '' : '?' }}{{param.paramName}}: {{ param.dataType }}{{ param.required ? '' : '?' }}{{ loop.last ? '' : ', ' -}}
@@ -48,19 +85,29 @@ module Line
4885
)
4986

5087
# {{ op.notes }}
88+
# This requests to <code>{{ op.httpMethod }} {{ endpoint(operations.classname) }}{{ op.path }}</code>
89+
# When you want to get HTTP status code or response headers, use {{ '{#' }}{{op.nickname}}_with_http_info} instead of this.
5190
#
5291
{% for param in op.allParams -%}
53-
# @param {{ param.paramName }} {{ param.description }}
92+
# @param {{param.paramName}} [{{ param.dataType }}{{ param.required ? '' : ', nil' }}] {{param.description}}
5493
{% endfor -%}
5594
{% if op.isDeprecated -%}
56-
# @deprecated
95+
# @deprecated
5796
{% endif -%}
5897
{% if op.externalDocs.description != null -%}
5998
# {{op.externalDocs.description}}
6099
{% endif -%}
61100
{% if op.externalDocs.url != null -%}
62101
# @see {{op.externalDocs.url}}
63-
{% endif -%}
102+
{%- endif %}
103+
{%- for response in op.responses %}
104+
{%- if response.content['application/json'].schema.complexType != null %}
105+
# @return [Line::Bot::V2::{{ packageName | camelize }}::{{ response.content['application/json'].schema.complexType }}] when HTTP status code is {{ response.code }}
106+
{%- else %}
107+
# @return [String, nil] when HTTP status code is {{ response.code }}
108+
{%- endif %}
109+
{%- endfor %}
110+
# @return [String, nil] when other HTTP status code is returned. This String is HTTP response body itself.
64111
def {{op.nickname}}: (
65112
{%- for param in op.allParams %}
66113
{{ param.required ? '' : '?' }}{{param.paramName}}: {{ param.dataType }}{{ param.required ? '' : '?' }}{{ loop.last ? '' : ', ' -}}

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

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,29 @@ module Line
3636
{% endif -%}
3737
{% endif -%}
3838
{% endfor %}
39+
40+
{# @param #}
41+
{%- for variable in model.model.vars -%}
42+
{% if model.model.vendorExtensions.get("x-selector").propertyName != variable.name -%}
43+
{% if variable.openApiType == 'array' -%}
44+
{% if variable.items.isModel -%}
45+
# @param {{ variable.name }} [{{ "Array[#{variable.items.openApiType}, Hash[Symbol, untyped]]" }}{% if not variable.required %},nil{% endif -%}] {{ variable.description }}
46+
{% elseif variable.items.allowableValues != null -%}
47+
# @param {{ variable.name }} [Array[{% for value in variable.items.allowableValues.values %}'{{ value }}'{{ loop.last ? '' : ',' }}{% endfor -%}]{% if not variable.required %},nil{% endif -%}] {{ variable.description }}
48+
{% else -%}
49+
# @param {{ variable.name }} [{{ variable.items.openApiType ? "Array[#{typeMapping[variable.items.openApiType]}]" : 'Array[untyped]' }}{% if not variable.required %},nil{% endif -%}] {{ variable.description }}
50+
{% endif -%}
51+
{% elseif variable.isModel -%}
52+
# @param {{ variable.name }} [{{ variable.openApiType }}, Hash[Symbol, untyped]{% if not variable.required %}, nil{% endif -%}] {{ variable.description }}
53+
{% else -%}
54+
{% if variable.allowableValues != null -%}
55+
# @param {{ variable.name }} [String{% if not variable.required %},nil{% endif -%}] ({% for value in variable.allowableValues.values %}'{{ value }}'{{ loop.last ? '' : '|' }}{% endfor %}) {{ variable.description }}
56+
{% else -%}
57+
# @param {{ variable.name }} [{{ typeMapping[variable.openApiType] ? typeMapping[variable.openApiType] : 'untyped' }}{% if not variable.required %},nil{% endif -%}] {{ variable.description }}
58+
{% endif -%}
59+
{% endif -%}
60+
{% endif -%}
61+
{% endfor -%}
3962
def initialize: (
4063
{% for variable in model.model.vars -%}
4164
{% if model.model.vendorExtensions.get("x-selector").propertyName != variable.name -%}
@@ -63,10 +86,16 @@ module Line
6386
**untyped dynamic_attributes
6487
) -> void
6588

89+
# Create an instance of the class from a hash
90+
# @param args [Hash] Hash containing all the required attributes
91+
# @return [Line::Bot::V2::{{ packageName | camelize }}::{{ model.model.classname }}] Instance of the class
6692
def self.create: (Hash[Symbol, untyped]) -> {{ model.model.classname }}
6793

94+
# @param other [Object] Object to compare
95+
# @return [Boolean] true if the objects are equal, false otherwise
6896
def ==: (untyped other) -> bool
6997

98+
# @return [Integer] Hash code of the object
7099
def hash: () -> Integer
71100
{%- if model.model.vendorExtensions.get("x-children") != null %}
72101

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,9 @@ def initialize(
3939
end
4040
end
4141

42+
# Create an instance of the class from a hash
43+
# @param args [Hash] Hash containing all the required attributes
44+
# @return [Line::Bot::V2::ChannelAccessToken::ChannelAccessTokenKeyIdsResponse] Instance of the class
4245
def self.create(args) # steep:ignore
4346
return new(**args) # steep:ignore
4447
end

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,9 @@ def initialize(
4444
end
4545
end
4646

47+
# Create an instance of the class from a hash
48+
# @param args [Hash] Hash containing all the required attributes
49+
# @return [Line::Bot::V2::ChannelAccessToken::ErrorResponse] Instance of the class
4750
def self.create(args) # steep:ignore
4851
return new(**args) # steep:ignore
4952
end

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,9 @@ def initialize(
5757
end
5858
end
5959

60+
# Create an instance of the class from a hash
61+
# @param args [Hash] Hash containing all the required attributes
62+
# @return [Line::Bot::V2::ChannelAccessToken::IssueChannelAccessTokenResponse] Instance of the class
6063
def self.create(args) # steep:ignore
6164
return new(**args) # steep:ignore
6265
end

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,9 @@ def initialize(
5151
end
5252
end
5353

54+
# Create an instance of the class from a hash
55+
# @param args [Hash] Hash containing all the required attributes
56+
# @return [Line::Bot::V2::ChannelAccessToken::IssueShortLivedChannelAccessTokenResponse] Instance of the class
5457
def self.create(args) # steep:ignore
5558
return new(**args) # steep:ignore
5659
end

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,9 @@ def initialize(
5151
end
5252
end
5353

54+
# Create an instance of the class from a hash
55+
# @param args [Hash] Hash containing all the required attributes
56+
# @return [Line::Bot::V2::ChannelAccessToken::IssueStatelessChannelAccessTokenResponse] Instance of the class
5457
def self.create(args) # steep:ignore
5558
return new(**args) # steep:ignore
5659
end

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,9 @@ def initialize(
5050
end
5151
end
5252

53+
# Create an instance of the class from a hash
54+
# @param args [Hash] Hash containing all the required attributes
55+
# @return [Line::Bot::V2::ChannelAccessToken::VerifyChannelAccessTokenResponse] Instance of the class
5356
def self.create(args) # steep:ignore
5457
return new(**args) # steep:ignore
5558
end

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,9 @@ def initialize(
4343
end
4444
end
4545

46+
# Create an instance of the class from a hash
47+
# @param args [Hash] Hash containing all the required attributes
48+
# @return [Line::Bot::V2::Insight::AgeTile] Instance of the class
4649
def self.create(args) # steep:ignore
4750
return new(**args) # steep:ignore
4851
end

0 commit comments

Comments
 (0)