All URIs are relative to https://q.trap.jp/api/v3
Method | HTTP request | Description |
---|---|---|
CreateClient | Post /clients | OAuth2クライアントを作成 |
DeleteClient | Delete /clients/{clientId} | OAuth2クライアントを削除 |
EditClient | Patch /clients/{clientId} | OAuth2クライアント情報を変更 |
GetClient | Get /clients/{clientId} | OAuth2クライアント情報を取得 |
GetClients | Get /clients | OAuth2クライアントのリストを取得 |
GetMyTokens | Get /users/me/tokens | 有効トークンのリストを取得 |
GetOAuth2Authorize | Get /oauth2/authorize | OAuth2 認可エンドポイント |
PostOAuth2Authorize | Post /oauth2/authorize | OAuth2 認可エンドポイント |
PostOAuth2AuthorizeDecide | Post /oauth2/authorize/decide | OAuth2 認可承諾API |
PostOAuth2Token | Post /oauth2/token | OAuth2 トークンエンドポイント |
RevokeClientTokens | Delete /clients/{clientId}/tokens | OAuthクライアントのトークンを削除 |
RevokeMyToken | Delete /users/me/tokens/{tokenId} | トークンの認可を取り消す |
RevokeOAuth2Token | Post /oauth2/revoke | OAuth2 トークン無効化エンドポイント |
OAuth2ClientDetail CreateClient(ctx).PostClientRequest(postClientRequest).Execute()
OAuth2クライアントを作成
package main
import (
"context"
"fmt"
"os"
traq "github.com/traPtitech/go-traq"
)
func main() {
postClientRequest := *traq.NewPostClientRequest("Name_example", "CallbackUrl_example", []traq.OAuth2Scope{traq.OAuth2Scope("openid")}, "Description_example") // PostClientRequest | (optional)
configuration := traq.NewConfiguration()
apiClient := traq.NewAPIClient(configuration)
resp, r, err := apiClient.Oauth2Api.CreateClient(context.Background()).PostClientRequest(postClientRequest).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `Oauth2Api.CreateClient``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
// response from `CreateClient`: OAuth2ClientDetail
fmt.Fprintf(os.Stdout, "Response from `Oauth2Api.CreateClient`: %v\n", resp)
}
Other parameters are passed through a pointer to a apiCreateClientRequest struct via the builder pattern
Name | Type | Description | Notes |
---|---|---|---|
postClientRequest | PostClientRequest |
- Content-Type: application/json
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
DeleteClient(ctx, clientId).Execute()
OAuth2クライアントを削除
package main
import (
"context"
"fmt"
"os"
traq "github.com/traPtitech/go-traq"
)
func main() {
clientId := "clientId_example" // string | OAuth2クライアントUUID
configuration := traq.NewConfiguration()
apiClient := traq.NewAPIClient(configuration)
r, err := apiClient.Oauth2Api.DeleteClient(context.Background(), clientId).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `Oauth2Api.DeleteClient``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
}
Name | Type | Description | Notes |
---|---|---|---|
ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. | |
clientId | string | OAuth2クライアントUUID |
Other parameters are passed through a pointer to a apiDeleteClientRequest struct via the builder pattern
Name | Type | Description | Notes |
---|
(empty response body)
- Content-Type: Not defined
- Accept: Not defined
[Back to top] [Back to API list] [Back to Model list] [Back to README]
EditClient(ctx, clientId).PatchClientRequest(patchClientRequest).Execute()
OAuth2クライアント情報を変更
package main
import (
"context"
"fmt"
"os"
traq "github.com/traPtitech/go-traq"
)
func main() {
clientId := "clientId_example" // string | OAuth2クライアントUUID
patchClientRequest := *traq.NewPatchClientRequest() // PatchClientRequest | (optional)
configuration := traq.NewConfiguration()
apiClient := traq.NewAPIClient(configuration)
r, err := apiClient.Oauth2Api.EditClient(context.Background(), clientId).PatchClientRequest(patchClientRequest).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `Oauth2Api.EditClient``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
}
Name | Type | Description | Notes |
---|---|---|---|
ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. | |
clientId | string | OAuth2クライアントUUID |
Other parameters are passed through a pointer to a apiEditClientRequest struct via the builder pattern
Name | Type | Description | Notes |
---|
patchClientRequest | PatchClientRequest | |
(empty response body)
- Content-Type: application/json
- Accept: Not defined
[Back to top] [Back to API list] [Back to Model list] [Back to README]
GetClient200Response GetClient(ctx, clientId).Detail(detail).Execute()
OAuth2クライアント情報を取得
package main
import (
"context"
"fmt"
"os"
traq "github.com/traPtitech/go-traq"
)
func main() {
clientId := "clientId_example" // string | OAuth2クライアントUUID
detail := true // bool | 詳細情報を含めるかどうか (optional) (default to false)
configuration := traq.NewConfiguration()
apiClient := traq.NewAPIClient(configuration)
resp, r, err := apiClient.Oauth2Api.GetClient(context.Background(), clientId).Detail(detail).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `Oauth2Api.GetClient``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
// response from `GetClient`: GetClient200Response
fmt.Fprintf(os.Stdout, "Response from `Oauth2Api.GetClient`: %v\n", resp)
}
Name | Type | Description | Notes |
---|---|---|---|
ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. | |
clientId | string | OAuth2クライアントUUID |
Other parameters are passed through a pointer to a apiGetClientRequest struct via the builder pattern
Name | Type | Description | Notes |
---|
detail | bool | 詳細情報を含めるかどうか | [default to false]
- Content-Type: Not defined
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
[]OAuth2Client GetClients(ctx).All(all).Execute()
OAuth2クライアントのリストを取得
package main
import (
"context"
"fmt"
"os"
traq "github.com/traPtitech/go-traq"
)
func main() {
all := true // bool | 全てのクライアントを取得するかどうか (optional) (default to false)
configuration := traq.NewConfiguration()
apiClient := traq.NewAPIClient(configuration)
resp, r, err := apiClient.Oauth2Api.GetClients(context.Background()).All(all).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `Oauth2Api.GetClients``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
// response from `GetClients`: []OAuth2Client
fmt.Fprintf(os.Stdout, "Response from `Oauth2Api.GetClients`: %v\n", resp)
}
Other parameters are passed through a pointer to a apiGetClientsRequest struct via the builder pattern
Name | Type | Description | Notes |
---|---|---|---|
all | bool | 全てのクライアントを取得するかどうか | [default to false] |
- Content-Type: Not defined
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
[]ActiveOAuth2Token GetMyTokens(ctx).Execute()
有効トークンのリストを取得
package main
import (
"context"
"fmt"
"os"
traq "github.com/traPtitech/go-traq"
)
func main() {
configuration := traq.NewConfiguration()
apiClient := traq.NewAPIClient(configuration)
resp, r, err := apiClient.Oauth2Api.GetMyTokens(context.Background()).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `Oauth2Api.GetMyTokens``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
// response from `GetMyTokens`: []ActiveOAuth2Token
fmt.Fprintf(os.Stdout, "Response from `Oauth2Api.GetMyTokens`: %v\n", resp)
}
This endpoint does not need any parameter.
Other parameters are passed through a pointer to a apiGetMyTokensRequest struct via the builder pattern
- Content-Type: Not defined
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
GetOAuth2Authorize(ctx).ClientId(clientId).ResponseType(responseType).RedirectUri(redirectUri).Scope(scope).State(state).CodeChallenge(codeChallenge).CodeChallengeMethod(codeChallengeMethod).Nonce(nonce).Prompt(prompt).Execute()
OAuth2 認可エンドポイント
package main
import (
"context"
"fmt"
"os"
traq "github.com/traPtitech/go-traq"
)
func main() {
clientId := "clientId_example" // string |
responseType := traq.OAuth2ResponseType("code") // OAuth2ResponseType | (optional)
redirectUri := "redirectUri_example" // string | (optional)
scope := "scope_example" // string | (optional)
state := "state_example" // string | (optional)
codeChallenge := "codeChallenge_example" // string | (optional)
codeChallengeMethod := "codeChallengeMethod_example" // string | (optional)
nonce := "nonce_example" // string | (optional)
prompt := traq.OAuth2Prompt("none") // OAuth2Prompt | (optional)
configuration := traq.NewConfiguration()
apiClient := traq.NewAPIClient(configuration)
r, err := apiClient.Oauth2Api.GetOAuth2Authorize(context.Background()).ClientId(clientId).ResponseType(responseType).RedirectUri(redirectUri).Scope(scope).State(state).CodeChallenge(codeChallenge).CodeChallengeMethod(codeChallengeMethod).Nonce(nonce).Prompt(prompt).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `Oauth2Api.GetOAuth2Authorize``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
}
Other parameters are passed through a pointer to a apiGetOAuth2AuthorizeRequest struct via the builder pattern
Name | Type | Description | Notes |
---|---|---|---|
clientId | string | ||
responseType | OAuth2ResponseType | ||
redirectUri | string | ||
scope | string | ||
state | string | ||
codeChallenge | string | ||
codeChallengeMethod | string | ||
nonce | string | ||
prompt | OAuth2Prompt |
(empty response body)
- Content-Type: Not defined
- Accept: Not defined
[Back to top] [Back to API list] [Back to Model list] [Back to README]
PostOAuth2Authorize(ctx).ClientId(clientId).ResponseType(responseType).RedirectUri(redirectUri).Scope(scope).State(state).CodeChallenge(codeChallenge).CodeChallengeMethod(codeChallengeMethod).Nonce(nonce).Prompt(prompt).Execute()
OAuth2 認可エンドポイント
package main
import (
"context"
"fmt"
"os"
traq "github.com/traPtitech/go-traq"
)
func main() {
clientId := "clientId_example" // string |
responseType := traq.OAuth2ResponseType("code") // OAuth2ResponseType | (optional)
redirectUri := "redirectUri_example" // string | (optional)
scope := "scope_example" // string | (optional)
state := "state_example" // string | (optional)
codeChallenge := "codeChallenge_example" // string | (optional)
codeChallengeMethod := "codeChallengeMethod_example" // string | (optional)
nonce := "nonce_example" // string | (optional)
prompt := traq.OAuth2Prompt("none") // OAuth2Prompt | (optional)
configuration := traq.NewConfiguration()
apiClient := traq.NewAPIClient(configuration)
r, err := apiClient.Oauth2Api.PostOAuth2Authorize(context.Background()).ClientId(clientId).ResponseType(responseType).RedirectUri(redirectUri).Scope(scope).State(state).CodeChallenge(codeChallenge).CodeChallengeMethod(codeChallengeMethod).Nonce(nonce).Prompt(prompt).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `Oauth2Api.PostOAuth2Authorize``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
}
Other parameters are passed through a pointer to a apiPostOAuth2AuthorizeRequest struct via the builder pattern
Name | Type | Description | Notes |
---|---|---|---|
clientId | string | ||
responseType | OAuth2ResponseType | ||
redirectUri | string | ||
scope | string | ||
state | string | ||
codeChallenge | string | ||
codeChallengeMethod | string | ||
nonce | string | ||
prompt | OAuth2Prompt |
(empty response body)
- Content-Type: application/x-www-form-urlencoded
- Accept: Not defined
[Back to top] [Back to API list] [Back to Model list] [Back to README]
PostOAuth2AuthorizeDecide(ctx).Submit(submit).Execute()
OAuth2 認可承諾API
package main
import (
"context"
"fmt"
"os"
traq "github.com/traPtitech/go-traq"
)
func main() {
submit := "submit_example" // string | 承諾する場合は\\\"approve\\\"
configuration := traq.NewConfiguration()
apiClient := traq.NewAPIClient(configuration)
r, err := apiClient.Oauth2Api.PostOAuth2AuthorizeDecide(context.Background()).Submit(submit).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `Oauth2Api.PostOAuth2AuthorizeDecide``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
}
Other parameters are passed through a pointer to a apiPostOAuth2AuthorizeDecideRequest struct via the builder pattern
Name | Type | Description | Notes |
---|---|---|---|
submit | string | 承諾する場合は\"approve\" |
(empty response body)
- Content-Type: application/x-www-form-urlencoded
- Accept: Not defined
[Back to top] [Back to API list] [Back to Model list] [Back to README]
OAuth2Token PostOAuth2Token(ctx).GrantType(grantType).Code(code).RedirectUri(redirectUri).ClientId(clientId).CodeVerifier(codeVerifier).Username(username).Password(password).Scope(scope).RefreshToken(refreshToken).ClientSecret(clientSecret).Execute()
OAuth2 トークンエンドポイント
package main
import (
"context"
"fmt"
"os"
traq "github.com/traPtitech/go-traq"
)
func main() {
grantType := "grantType_example" // string |
code := "code_example" // string | (optional)
redirectUri := "redirectUri_example" // string | (optional)
clientId := "clientId_example" // string | (optional)
codeVerifier := "codeVerifier_example" // string | (optional)
username := "username_example" // string | (optional)
password := "password_example" // string | (optional)
scope := "scope_example" // string | (optional)
refreshToken := "refreshToken_example" // string | (optional)
clientSecret := "clientSecret_example" // string | (optional)
configuration := traq.NewConfiguration()
apiClient := traq.NewAPIClient(configuration)
resp, r, err := apiClient.Oauth2Api.PostOAuth2Token(context.Background()).GrantType(grantType).Code(code).RedirectUri(redirectUri).ClientId(clientId).CodeVerifier(codeVerifier).Username(username).Password(password).Scope(scope).RefreshToken(refreshToken).ClientSecret(clientSecret).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `Oauth2Api.PostOAuth2Token``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
// response from `PostOAuth2Token`: OAuth2Token
fmt.Fprintf(os.Stdout, "Response from `Oauth2Api.PostOAuth2Token`: %v\n", resp)
}
Other parameters are passed through a pointer to a apiPostOAuth2TokenRequest struct via the builder pattern
Name | Type | Description | Notes |
---|---|---|---|
grantType | string | ||
code | string | ||
redirectUri | string | ||
clientId | string | ||
codeVerifier | string | ||
username | string | ||
password | string | ||
scope | string | ||
refreshToken | string | ||
clientSecret | string |
- Content-Type: application/x-www-form-urlencoded
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
RevokeClientTokens(ctx, clientId).Execute()
OAuthクライアントのトークンを削除
package main
import (
"context"
"fmt"
"os"
traq "github.com/traPtitech/go-traq"
)
func main() {
clientId := "clientId_example" // string | OAuth2クライアントUUID
configuration := traq.NewConfiguration()
apiClient := traq.NewAPIClient(configuration)
r, err := apiClient.Oauth2Api.RevokeClientTokens(context.Background(), clientId).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `Oauth2Api.RevokeClientTokens``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
}
Name | Type | Description | Notes |
---|---|---|---|
ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. | |
clientId | string | OAuth2クライアントUUID |
Other parameters are passed through a pointer to a apiRevokeClientTokensRequest struct via the builder pattern
Name | Type | Description | Notes |
---|
(empty response body)
- Content-Type: Not defined
- Accept: Not defined
[Back to top] [Back to API list] [Back to Model list] [Back to README]
RevokeMyToken(ctx, tokenId).Execute()
トークンの認可を取り消す
package main
import (
"context"
"fmt"
"os"
traq "github.com/traPtitech/go-traq"
)
func main() {
tokenId := "38400000-8cf0-11bd-b23e-10b96e4ef00d" // string | OAuth2トークンUUID
configuration := traq.NewConfiguration()
apiClient := traq.NewAPIClient(configuration)
r, err := apiClient.Oauth2Api.RevokeMyToken(context.Background(), tokenId).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `Oauth2Api.RevokeMyToken``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
}
Name | Type | Description | Notes |
---|---|---|---|
ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. | |
tokenId | string | OAuth2トークンUUID |
Other parameters are passed through a pointer to a apiRevokeMyTokenRequest struct via the builder pattern
Name | Type | Description | Notes |
---|
(empty response body)
- Content-Type: Not defined
- Accept: Not defined
[Back to top] [Back to API list] [Back to Model list] [Back to README]
RevokeOAuth2Token(ctx).Token(token).Execute()
OAuth2 トークン無効化エンドポイント
package main
import (
"context"
"fmt"
"os"
traq "github.com/traPtitech/go-traq"
)
func main() {
token := "token_example" // string | 無効化するOAuth2トークンまたはOAuth2リフレッシュトークン
configuration := traq.NewConfiguration()
apiClient := traq.NewAPIClient(configuration)
r, err := apiClient.Oauth2Api.RevokeOAuth2Token(context.Background()).Token(token).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `Oauth2Api.RevokeOAuth2Token``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
}
Other parameters are passed through a pointer to a apiRevokeOAuth2TokenRequest struct via the builder pattern
Name | Type | Description | Notes |
---|---|---|---|
token | string | 無効化するOAuth2トークンまたはOAuth2リフレッシュトークン |
(empty response body)
- Content-Type: application/x-www-form-urlencoded
- Accept: Not defined
[Back to top] [Back to API list] [Back to Model list] [Back to README]