diff --git a/.rubocop.yml b/.rubocop.yml
index 104a98d8..13dc6a9b 100644
--- a/.rubocop.yml
+++ b/.rubocop.yml
@@ -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/**/*'
diff --git a/generator/src/main/resources/line-bot-sdk-ruby-generator/api.pebble b/generator/src/main/resources/line-bot-sdk-ruby-generator/api.pebble
index a0111cbd..d711105a 100644
--- a/generator/src/main/resources/line-bot-sdk-ruby-generator/api.pebble
+++ b/generator/src/main/resources/line-bot-sdk-ruby-generator/api.pebble
@@ -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 {{ op.httpMethod }} {{ endpoint(operations.classname) }}{{ op.path }}
# This returns an array containing response, HTTP status code, and header in order. Please specify all header keys in lowercase.
@@ -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 {{ op.httpMethod }} {{ endpoint(operations.classname) }}{{ op.path }}
# When you want to get HTTP status code or response headers, use {{ '{#' }}{{op.nickname}}_with_http_info} instead of this.
@@ -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
diff --git a/generator/src/main/resources/line-bot-sdk-ruby-generator/body/api/ChannelAccessTokenClient.rb b/generator/src/main/resources/line-bot-sdk-ruby-generator/body/api/ChannelAccessTokenClient.rb
new file mode 100644
index 00000000..203144e9
--- /dev/null
+++ b/generator/src/main/resources/line-bot-sdk-ruby-generator/body/api/ChannelAccessTokenClient.rb
@@ -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 POST https://api.line.me/oauth2/v3/token
+ # 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 POST https://api.line.me/oauth2/v3/token
+ # 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 POST https://api.line.me/oauth2/v3/token
+ # 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 POST https://api.line.me/oauth2/v3/token
+ # 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
diff --git a/generator/src/main/resources/line-bot-sdk-ruby-rbs-generator/api.pebble b/generator/src/main/resources/line-bot-sdk-ruby-rbs-generator/api.pebble
index d984fa52..55eda201 100644
--- a/generator/src/main/resources/line-bot-sdk-ruby-rbs-generator/api.pebble
+++ b/generator/src/main/resources/line-bot-sdk-ruby-rbs-generator/api.pebble
@@ -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 ? '' : ', ' -}}
@@ -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 ? '' : ', ' -}}
@@ -119,6 +125,10 @@ module Line
| String? # otherwise
)
{%- endfor %}
+{%- if ["ChannelAccessTokenClient"] contains operations.classname %}
+
+{% include "./body/api/" + operations.classname + ".rbs" %}
+{%- endif %}
end
end
end
diff --git a/generator/src/main/resources/line-bot-sdk-ruby-rbs-generator/body/api/ChannelAccessTokenClient.rbs b/generator/src/main/resources/line-bot-sdk-ruby-rbs-generator/body/api/ChannelAccessTokenClient.rbs
new file mode 100644
index 00000000..59f87267
--- /dev/null
+++ b/generator/src/main/resources/line-bot-sdk-ruby-rbs-generator/body/api/ChannelAccessTokenClient.rbs
@@ -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 POST https://api.line.me/oauth2/v3/token
+ # 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 POST https://api.line.me/oauth2/v3/token
+ # 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 POST https://api.line.me/oauth2/v3/token
+ # 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 POST https://api.line.me/oauth2/v3/token
+ # 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
+ )
diff --git a/lib/line/bot/v2/channel_access_token/api/channel_access_token_client.rb b/lib/line/bot/v2/channel_access_token/api/channel_access_token_client.rb
index 3fed06a0..73bba3a4 100644
--- a/lib/line/bot/v2/channel_access_token/api/channel_access_token_client.rb
+++ b/lib/line/bot/v2/channel_access_token/api/channel_access_token_client.rb
@@ -237,6 +237,10 @@ def issue_channel_token_by_jwt(
response_body
end
+ # @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.
+ #
# Issues a new stateless channel access token, 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 requests to POST https://api.line.me/oauth2/v3/token
# This returns an array containing response, HTTP status code, and header in order. Please specify all header keys in lowercase.
@@ -284,6 +288,10 @@ def issue_stateless_channel_token_with_http_info( # steep:ignore MethodBodyTypeM
end
end
+ # @deprecated
+ # This is deprecated.
+ # Please use {#issue_stateless_channel_token_by_jwt_assertion} or {#issue_stateless_channel_token_by_client_secret} instead.
+ #
# Issues a new stateless channel access token, 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 requests to POST https://api.line.me/oauth2/v3/token
# When you want to get HTTP status code or response headers, use {#issue_stateless_channel_token_with_http_info} instead of this.
@@ -303,7 +311,7 @@ def issue_stateless_channel_token(
client_id: nil,
client_secret: nil
)
- response_body, _status_code, _headers = issue_stateless_channel_token_with_http_info(
+ response_body, _status_code, _headers = issue_stateless_channel_token_with_http_info( # steep:ignore DeprecatedReference
grant_type: grant_type,
client_assertion_type: client_assertion_type,
client_assertion: client_assertion,
@@ -526,6 +534,87 @@ def verify_channel_token_by_jwt(
response_body
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 POST https://api.line.me/oauth2/v3/token
+ # 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 POST https://api.line.me/oauth2/v3/token
+ # 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 POST https://api.line.me/oauth2/v3/token
+ # 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 POST https://api.line.me/oauth2/v3/token
+ # 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
+
end
end
end
diff --git a/sig/line/bot/v2/channel_access_token/api/channel_access_token_client.rbs b/sig/line/bot/v2/channel_access_token/api/channel_access_token_client.rbs
index 59187fc3..67749e14 100644
--- a/sig/line/bot/v2/channel_access_token/api/channel_access_token_client.rbs
+++ b/sig/line/bot/v2/channel_access_token/api/channel_access_token_client.rbs
@@ -159,6 +159,7 @@ module Line
# @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.
+ %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}
def issue_stateless_channel_token_with_http_info: (
?grant_type: String?,
?client_assertion_type: String?,
@@ -182,6 +183,7 @@ module Line
# @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.
+ %a{deprecated: Use #issue_stateless_channel_token_by_jwt_assertion or #issue_stateless_channel_token_by_client_secret instead}
def issue_stateless_channel_token: (
?grant_type: String?,
?client_assertion_type: String?,
@@ -320,6 +322,75 @@ module Line
VerifyChannelAccessTokenResponse # 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 POST https://api.line.me/oauth2/v3/token
+ # 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 POST https://api.line.me/oauth2/v3/token
+ # 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 POST https://api.line.me/oauth2/v3/token
+ # 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 POST https://api.line.me/oauth2/v3/token
+ # 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
+ )
+
end
end
end
diff --git a/spec/line/bot/v2/misc_spec.rb b/spec/line/bot/v2/misc_spec.rb
index d4178f6e..47ae53e3 100644
--- a/spec/line/bot/v2/misc_spec.rb
+++ b/spec/line/bot/v2/misc_spec.rb
@@ -431,6 +431,66 @@
end
end
+ describe 'issue_stateless_channel_token_by_jwt_assertion' do
+ let(:client) { Line::Bot::V2::ChannelAccessToken::ApiClient.new }
+ let(:client_assertion) { 'eyJhbGciOiJSUzI.dummy' }
+ let(:response_body) { { "access_token" => "test-access-token", "expires_in" => 900, "token_type" => "Bearer" }.to_json }
+ let(:response_code) { 200 }
+
+ it "sends only JWT assertion parameters" do
+ stub_request(:post, "https://api.line.me/oauth2/v3/token")
+ .with(
+ body: {
+ grant_type: "client_credentials",
+ client_assertion_type: "urn:ietf:params:oauth:client-assertion-type:jwt-bearer",
+ client_assertion: client_assertion
+ },
+ headers: {
+ 'Content-Type' => 'application/x-www-form-urlencoded'
+ }
+ )
+ .to_return(status: response_code, body: response_body, headers: { 'Content-Type' => 'application/json' })
+
+ body = client.issue_stateless_channel_token_by_jwt_assertion(
+ client_assertion: client_assertion
+ )
+
+ expect(body.access_token).to eq('test-access-token')
+ expect(body.token_type).to eq('Bearer')
+ end
+ end
+
+ describe 'issue_stateless_channel_token_by_client_secret' do
+ let(:client) { Line::Bot::V2::ChannelAccessToken::ApiClient.new }
+ let(:client_id) { 'test-client-id' }
+ let(:client_secret) { 'test-client-secret' }
+ let(:response_body) { { "access_token" => "test-access-token", "expires_in" => 900, "token_type" => "Bearer" }.to_json }
+ let(:response_code) { 200 }
+
+ it "sends only client secret parameters" do
+ stub_request(:post, "https://api.line.me/oauth2/v3/token")
+ .with(
+ body: {
+ grant_type: "client_credentials",
+ client_id: client_id,
+ client_secret: client_secret
+ },
+ headers: {
+ 'Content-Type' => 'application/x-www-form-urlencoded'
+ }
+ )
+ .to_return(status: response_code, body: response_body, headers: { 'Content-Type' => 'application/json' })
+
+ body = client.issue_stateless_channel_token_by_client_secret(
+ client_id: client_id,
+ client_secret: client_secret
+ )
+
+ expect(body.access_token).to eq('test-access-token')
+ expect(body.token_type).to eq('Bearer')
+ end
+ end
+
describe 'GET /v2/bot/followers/ids' do
let(:client) { Line::Bot::V2::MessagingApi::ApiClient.new(channel_access_token: 'test-channel-access-token') }
let(:response_code) { 200 }