Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ AllCops:
TargetRubyVersion: 2.4
Exclude:
- 'examples/**/*'
- 'generator/**/*'
- 'lib/line/bot/v2/channel_access_token/**/*'
- 'lib/line/bot/v2/insight/**/*'
- 'lib/line/bot/v2/liff/**/*'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,12 @@ module Line
end
{%- for op in operations.operation %}

{% if op.nickname == "issue_stateless_channel_token" -%}
# @deprecated
# This is deprecated.
# Please use {{ '{' }}#issue_stateless_channel_token_by_jwt_assertion_with_http_info} or {{ '{' }}#issue_stateless_channel_token_by_client_secret_with_http_info} instead.
#
{% endif -%}
# {{ op.notes }}
# This requests to <code>{{ op.httpMethod }} {{ endpoint(operations.classname) }}{{ op.path }}</code>
# This returns an array containing response, HTTP status code, and header in order. Please specify all header keys in lowercase.
Expand Down Expand Up @@ -132,6 +138,12 @@ module Line
end
end

{% if op.nickname == "issue_stateless_channel_token" -%}
# @deprecated
# This is deprecated.
# Please use {{ '{' }}#issue_stateless_channel_token_by_jwt_assertion} or {{ '{' }}#issue_stateless_channel_token_by_client_secret} instead.
#
{% endif -%}
# {{ op.notes }}
# This requests to <code>{{ op.httpMethod }} {{ endpoint(operations.classname) }}{{ op.path }}</code>
# When you want to get HTTP status code or response headers, use {{ '{#' }}{{op.nickname}}_with_http_info} instead of this.
Expand Down Expand Up @@ -160,13 +172,17 @@ module Line
{{param.paramName}}:{{ param.required ? '' : ' nil' }}{{ loop.last ? '' : ',' -}}
{% endfor %}
)
response_body, _status_code, _headers = {{op.nickname}}_with_http_info({% for param in op.allParams %}
response_body, _status_code, _headers = {{op.nickname}}_with_http_info({% if op.nickname == "issue_stateless_channel_token" %} # steep:ignore DeprecatedReference{% endif %}{% for param in op.allParams %}
{{param.paramName}}: {{param.paramName}}{{ loop.last ? '' : ',' -}}
{% endfor %}
)

response_body
end{% endfor %}
{%- if ["ChannelAccessTokenClient"] contains operations.classname %}

{% include "./body/api/" + operations.classname + ".rb" %}
{%- endif %}
end
end
end
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
# Issues a new stateless channel access token by JWT assertion, which doesn't have max active token limit unlike the other token types. The newly issued token is only valid for 15 minutes but can not be revoked until it naturally expires.
# This is a convenience wrapper that only requires the parameters needed for JWT assertion authentication.
# This requests to <code>POST https://api.line.me/oauth2/v3/token</code>
# When you want to get HTTP status code or response headers, use {{ '{#' }}issue_stateless_channel_token_by_jwt_assertion_with_http_info} instead of this.
#
# @param client_assertion [String] A JSON Web Token the client needs to create and sign with the private key of the Assertion Signing Key.
# @see https://developers.line.biz/en/reference/messaging-api/#issue-stateless-channel-access-token
# @return [Line::Bot::V2::ChannelAccessToken::IssueStatelessChannelAccessTokenResponse] when HTTP status code is 200
# @return [String, nil] when other HTTP status code is returned. This String is HTTP response body itself.
def issue_stateless_channel_token_by_jwt_assertion(
client_assertion:
)
issue_stateless_channel_token( # steep:ignore DeprecatedReference
grant_type: 'client_credentials',
client_assertion_type: 'urn:ietf:params:oauth:client-assertion-type:jwt-bearer',
client_assertion: client_assertion
)
end

# Issues a new stateless channel access token by client secret, which doesn't have max active token limit unlike the other token types. The newly issued token is only valid for 15 minutes but can not be revoked until it naturally expires.
# This is a convenience wrapper that only requires the parameters needed for client secret authentication.
# This requests to <code>POST https://api.line.me/oauth2/v3/token</code>
# When you want to get HTTP status code or response headers, use {{ '{#' }}issue_stateless_channel_token_by_client_secret_with_http_info} instead of this.
#
# @param client_id [String] Channel ID.
# @param client_secret [String] Channel secret.
# @see https://developers.line.biz/en/reference/messaging-api/#issue-stateless-channel-access-token
# @return [Line::Bot::V2::ChannelAccessToken::IssueStatelessChannelAccessTokenResponse] when HTTP status code is 200
# @return [String, nil] when other HTTP status code is returned. This String is HTTP response body itself.
def issue_stateless_channel_token_by_client_secret(
client_id:,
client_secret:
)
issue_stateless_channel_token( # steep:ignore DeprecatedReference
grant_type: 'client_credentials',
client_id: client_id,
client_secret: client_secret
)
end

# Issues a new stateless channel access token by JWT assertion, which doesn't have max active token limit unlike the other token types. The newly issued token is only valid for 15 minutes but can not be revoked until it naturally expires.
# This is a convenience wrapper that only requires the parameters needed for JWT assertion authentication.
# This requests to <code>POST https://api.line.me/oauth2/v3/token</code>
# This returns an array containing response, HTTP status code, and header in order. Please specify all header keys in lowercase.
#
# @param client_assertion [String] A JSON Web Token the client needs to create and sign with the private key of the Assertion Signing Key.
# @see https://developers.line.biz/en/reference/messaging-api/#issue-stateless-channel-access-token
# @return [Array(Line::Bot::V2::ChannelAccessToken::IssueStatelessChannelAccessTokenResponse, Integer, Hash{String => String})] when HTTP status code is 200
# @return [Array((String|nil), Integer, Hash{String => String})] when other HTTP status code is returned. String is HTTP response body itself.
def issue_stateless_channel_token_by_jwt_assertion_with_http_info(
client_assertion:
)
issue_stateless_channel_token_with_http_info( # steep:ignore DeprecatedReference
grant_type: 'client_credentials',
client_assertion_type: 'urn:ietf:params:oauth:client-assertion-type:jwt-bearer',
client_assertion: client_assertion
)
end

# Issues a new stateless channel access token by client secret, which doesn't have max active token limit unlike the other token types. The newly issued token is only valid for 15 minutes but can not be revoked until it naturally expires.
# This is a convenience wrapper that only requires the parameters needed for client secret authentication.
# This requests to <code>POST https://api.line.me/oauth2/v3/token</code>
# This returns an array containing response, HTTP status code, and header in order. Please specify all header keys in lowercase.
#
# @param client_id [String] Channel ID.
# @param client_secret [String] Channel secret.
# @see https://developers.line.biz/en/reference/messaging-api/#issue-stateless-channel-access-token
# @return [Array(Line::Bot::V2::ChannelAccessToken::IssueStatelessChannelAccessTokenResponse, Integer, Hash{String => String})] when HTTP status code is 200
# @return [Array((String|nil), Integer, Hash{String => String})] when other HTTP status code is returned. String is HTTP response body itself.
def issue_stateless_channel_token_by_client_secret_with_http_info(
client_id:,
client_secret:
)
issue_stateless_channel_token_with_http_info( # steep:ignore DeprecatedReference
grant_type: 'client_credentials',
client_id: client_id,
client_secret: client_secret
)
end
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,9 @@ module Line
{%- endif %}
{%- endfor %}
# @return [Array((String|nil), Integer, Hash{String => String})] when other HTTP status code is returned. String is HTTP response body itself.
{% if op.nickname == "issue_stateless_channel_token" -%}
%a{deprecated: Use #issue_stateless_channel_token_by_jwt_assertion_with_http_info or #issue_stateless_channel_token_by_client_secret_with_http_info instead}
{% endif -%}
def {{op.nickname}}_with_http_info: (
{%- for param in op.allParams %}
{{ param.required ? '' : '?' }}{{param.paramName}}: {{ formatDataType(param) }}{{ param.required ? '' : '?' }}{{ loop.last ? '' : ', ' -}}
Expand Down Expand Up @@ -108,6 +111,9 @@ module Line
{%- endif %}
{%- endfor %}
# @return [String, nil] when other HTTP status code is returned. This String is HTTP response body itself.
{% if op.nickname == "issue_stateless_channel_token" -%}
%a{deprecated: Use #issue_stateless_channel_token_by_jwt_assertion or #issue_stateless_channel_token_by_client_secret instead}
{% endif -%}
def {{op.nickname}}: (
{%- for param in op.allParams %}
{{ param.required ? '' : '?' }}{{param.paramName}}: {{ formatDataType(param) }}{{ param.required ? '' : '?' }}{{ loop.last ? '' : ', ' -}}
Expand All @@ -119,6 +125,10 @@ module Line
| String? # otherwise
)
{%- endfor %}
{%- if ["ChannelAccessTokenClient"] contains operations.classname %}

{% include "./body/api/" + operations.classname + ".rbs" %}
{%- endif %}
end
end
end
Expand Down
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could you add comment in rbs file too?

Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
# Issues a new stateless channel access token by JWT assertion, which doesn't have max active token limit unlike the other token types. The newly issued token is only valid for 15 minutes but can not be revoked until it naturally expires.
# This is a convenience wrapper that only requires the parameters needed for JWT assertion authentication.
# This requests to <code>POST https://api.line.me/oauth2/v3/token</code>
# When you want to get HTTP status code or response headers, use {{ '{#' }}issue_stateless_channel_token_by_jwt_assertion_with_http_info} instead of this.
#
# @param client_assertion [String] A JSON Web Token the client needs to create and sign with the private key of the Assertion Signing Key.
# @see https://developers.line.biz/en/reference/messaging-api/#issue-stateless-channel-access-token
# @return [Line::Bot::V2::ChannelAccessToken::IssueStatelessChannelAccessTokenResponse] when HTTP status code is 200
# @return [String, nil] when other HTTP status code is returned. This String is HTTP response body itself.
def issue_stateless_channel_token_by_jwt_assertion: (
client_assertion: String
) -> (
IssueStatelessChannelAccessTokenResponse # when HTTP status code is 200
| String? # otherwise
)

# Issues a new stateless channel access token by client secret, which doesn't have max active token limit unlike the other token types. The newly issued token is only valid for 15 minutes but can not be revoked until it naturally expires.
# This is a convenience wrapper that only requires the parameters needed for client secret authentication.
# This requests to <code>POST https://api.line.me/oauth2/v3/token</code>
# When you want to get HTTP status code or response headers, use {{ '{#' }}issue_stateless_channel_token_by_client_secret_with_http_info} instead of this.
#
# @param client_id [String] Channel ID.
# @param client_secret [String] Channel secret.
# @see https://developers.line.biz/en/reference/messaging-api/#issue-stateless-channel-access-token
# @return [Line::Bot::V2::ChannelAccessToken::IssueStatelessChannelAccessTokenResponse] when HTTP status code is 200
# @return [String, nil] when other HTTP status code is returned. This String is HTTP response body itself.
def issue_stateless_channel_token_by_client_secret: (
client_id: String,
client_secret: String
) -> (
IssueStatelessChannelAccessTokenResponse # when HTTP status code is 200
| String? # otherwise
)

# Issues a new stateless channel access token by JWT assertion, which doesn't have max active token limit unlike the other token types. The newly issued token is only valid for 15 minutes but can not be revoked until it naturally expires.
# This is a convenience wrapper that only requires the parameters needed for JWT assertion authentication.
# This requests to <code>POST https://api.line.me/oauth2/v3/token</code>
# This returns an array containing response, HTTP status code, and header in order. Please specify all header keys in lowercase.
#
# @param client_assertion [String] A JSON Web Token the client needs to create and sign with the private key of the Assertion Signing Key.
# @see https://developers.line.biz/en/reference/messaging-api/#issue-stateless-channel-access-token
# @return [Array(Line::Bot::V2::ChannelAccessToken::IssueStatelessChannelAccessTokenResponse, Integer, Hash{String => String})] when HTTP status code is 200
# @return [Array((String|nil), Integer, Hash{String => String})] when other HTTP status code is returned. String is HTTP response body itself.
def issue_stateless_channel_token_by_jwt_assertion_with_http_info: (
client_assertion: String
) -> (
[IssueStatelessChannelAccessTokenResponse, 200, Hash[untyped, untyped]] # when HTTP status code is 200
| [String?, Integer, Hash[untyped, untyped]] # otherwise
)

# Issues a new stateless channel access token by client secret, which doesn't have max active token limit unlike the other token types. The newly issued token is only valid for 15 minutes but can not be revoked until it naturally expires.
# This is a convenience wrapper that only requires the parameters needed for client secret authentication.
# This requests to <code>POST https://api.line.me/oauth2/v3/token</code>
# This returns an array containing response, HTTP status code, and header in order. Please specify all header keys in lowercase.
#
# @param client_id [String] Channel ID.
# @param client_secret [String] Channel secret.
# @see https://developers.line.biz/en/reference/messaging-api/#issue-stateless-channel-access-token
# @return [Array(Line::Bot::V2::ChannelAccessToken::IssueStatelessChannelAccessTokenResponse, Integer, Hash{String => String})] when HTTP status code is 200
# @return [Array((String|nil), Integer, Hash{String => String})] when other HTTP status code is returned. String is HTTP response body itself.
def issue_stateless_channel_token_by_client_secret_with_http_info: (
client_id: String,
client_secret: String
) -> (
[IssueStatelessChannelAccessTokenResponse, 200, Hash[untyped, untyped]] # when HTTP status code is 200
| [String?, Integer, Hash[untyped, untyped]] # otherwise
)
Loading