All URIs are relative to https://q.trap.jp/api/v3
Method | HTTP request | Description |
---|---|---|
CreateChannel | Post /channels | チャンネルを作成 |
EditChannel | Patch /channels/{channelId} | チャンネル情報を変更 |
EditChannelSubscribers | Patch /channels/{channelId}/subscribers | チャンネルの通知購読者を編集 |
EditChannelTopic | Put /channels/{channelId}/topic | チャンネルトピックを編集 |
GetChannel | Get /channels/{channelId} | チャンネル情報を取得 |
GetChannelBots | Get /channels/{channelId}/bots | チャンネル参加中のBOTのリストを取得 |
GetChannelEvents | Get /channels/{channelId}/events | チャンネルイベントのリストを取得 |
GetChannelPath | Get /channels/{channelId}/path | 指定したチャンネルパスを取得 |
GetChannelPins | Get /channels/{channelId}/pins | チャンネルピンのリストを取得 |
GetChannelStats | Get /channels/{channelId}/stats | チャンネル統計情報を取得 |
GetChannelSubscribers | Get /channels/{channelId}/subscribers | チャンネルの通知購読者のリストを取得 |
GetChannelTopic | Get /channels/{channelId}/topic | チャンネルトピックを取得 |
GetChannelViewers | Get /channels/{channelId}/viewers | チャンネル閲覧者リストを取得 |
GetChannels | Get /channels | チャンネルリストを取得 |
GetMessages | Get /channels/{channelId}/messages | チャンネルメッセージのリストを取得 |
GetUserDMChannel | Get /users/{userId}/dm-channel | DMチャンネル情報を取得 |
PostMessage | Post /channels/{channelId}/messages | チャンネルにメッセージを投稿 |
SetChannelSubscribers | Put /channels/{channelId}/subscribers | チャンネルの通知購読者を設定 |
Channel CreateChannel(ctx).PostChannelRequest(postChannelRequest).Execute()
チャンネルを作成
package main
import (
"context"
"fmt"
"os"
traq "github.com/traPtitech/go-traq"
)
func main() {
postChannelRequest := *traq.NewPostChannelRequest("Name_example", "Parent_example") // PostChannelRequest | (optional)
configuration := traq.NewConfiguration()
apiClient := traq.NewAPIClient(configuration)
resp, r, err := apiClient.ChannelApi.CreateChannel(context.Background()).PostChannelRequest(postChannelRequest).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `ChannelApi.CreateChannel``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
// response from `CreateChannel`: Channel
fmt.Fprintf(os.Stdout, "Response from `ChannelApi.CreateChannel`: %v\n", resp)
}
Other parameters are passed through a pointer to a apiCreateChannelRequest struct via the builder pattern
Name | Type | Description | Notes |
---|---|---|---|
postChannelRequest | PostChannelRequest |
- Content-Type: application/json
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
EditChannel(ctx, channelId).PatchChannelRequest(patchChannelRequest).Execute()
チャンネル情報を変更
package main
import (
"context"
"fmt"
"os"
traq "github.com/traPtitech/go-traq"
)
func main() {
channelId := "38400000-8cf0-11bd-b23e-10b96e4ef00d" // string | チャンネルUUID
patchChannelRequest := *traq.NewPatchChannelRequest() // PatchChannelRequest | (optional)
configuration := traq.NewConfiguration()
apiClient := traq.NewAPIClient(configuration)
r, err := apiClient.ChannelApi.EditChannel(context.Background(), channelId).PatchChannelRequest(patchChannelRequest).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `ChannelApi.EditChannel``: %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. | |
channelId | string | チャンネルUUID |
Other parameters are passed through a pointer to a apiEditChannelRequest struct via the builder pattern
Name | Type | Description | Notes |
---|
patchChannelRequest | PatchChannelRequest | |
(empty response body)
- Content-Type: application/json
- Accept: Not defined
[Back to top] [Back to API list] [Back to Model list] [Back to README]
EditChannelSubscribers(ctx, channelId).PatchChannelSubscribersRequest(patchChannelSubscribersRequest).Execute()
チャンネルの通知購読者を編集
package main
import (
"context"
"fmt"
"os"
traq "github.com/traPtitech/go-traq"
)
func main() {
channelId := "38400000-8cf0-11bd-b23e-10b96e4ef00d" // string | チャンネルUUID
patchChannelSubscribersRequest := *traq.NewPatchChannelSubscribersRequest() // PatchChannelSubscribersRequest | (optional)
configuration := traq.NewConfiguration()
apiClient := traq.NewAPIClient(configuration)
r, err := apiClient.ChannelApi.EditChannelSubscribers(context.Background(), channelId).PatchChannelSubscribersRequest(patchChannelSubscribersRequest).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `ChannelApi.EditChannelSubscribers``: %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. | |
channelId | string | チャンネルUUID |
Other parameters are passed through a pointer to a apiEditChannelSubscribersRequest struct via the builder pattern
Name | Type | Description | Notes |
---|
patchChannelSubscribersRequest | PatchChannelSubscribersRequest | |
(empty response body)
- Content-Type: application/json
- Accept: Not defined
[Back to top] [Back to API list] [Back to Model list] [Back to README]
EditChannelTopic(ctx, channelId).PutChannelTopicRequest(putChannelTopicRequest).Execute()
チャンネルトピックを編集
package main
import (
"context"
"fmt"
"os"
traq "github.com/traPtitech/go-traq"
)
func main() {
channelId := "38400000-8cf0-11bd-b23e-10b96e4ef00d" // string | チャンネルUUID
putChannelTopicRequest := *traq.NewPutChannelTopicRequest("Topic_example") // PutChannelTopicRequest | (optional)
configuration := traq.NewConfiguration()
apiClient := traq.NewAPIClient(configuration)
r, err := apiClient.ChannelApi.EditChannelTopic(context.Background(), channelId).PutChannelTopicRequest(putChannelTopicRequest).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `ChannelApi.EditChannelTopic``: %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. | |
channelId | string | チャンネルUUID |
Other parameters are passed through a pointer to a apiEditChannelTopicRequest struct via the builder pattern
Name | Type | Description | Notes |
---|
putChannelTopicRequest | PutChannelTopicRequest | |
(empty response body)
- Content-Type: application/json
- Accept: Not defined
[Back to top] [Back to API list] [Back to Model list] [Back to README]
Channel GetChannel(ctx, channelId).Execute()
チャンネル情報を取得
package main
import (
"context"
"fmt"
"os"
traq "github.com/traPtitech/go-traq"
)
func main() {
channelId := "38400000-8cf0-11bd-b23e-10b96e4ef00d" // string | チャンネルUUID
configuration := traq.NewConfiguration()
apiClient := traq.NewAPIClient(configuration)
resp, r, err := apiClient.ChannelApi.GetChannel(context.Background(), channelId).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `ChannelApi.GetChannel``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
// response from `GetChannel`: Channel
fmt.Fprintf(os.Stdout, "Response from `ChannelApi.GetChannel`: %v\n", resp)
}
Name | Type | Description | Notes |
---|---|---|---|
ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. | |
channelId | string | チャンネルUUID |
Other parameters are passed through a pointer to a apiGetChannelRequest struct via the builder pattern
Name | Type | Description | Notes |
---|
- Content-Type: Not defined
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
[]BotUser GetChannelBots(ctx, channelId).Execute()
チャンネル参加中のBOTのリストを取得
package main
import (
"context"
"fmt"
"os"
traq "github.com/traPtitech/go-traq"
)
func main() {
channelId := "38400000-8cf0-11bd-b23e-10b96e4ef00d" // string | チャンネルUUID
configuration := traq.NewConfiguration()
apiClient := traq.NewAPIClient(configuration)
resp, r, err := apiClient.ChannelApi.GetChannelBots(context.Background(), channelId).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `ChannelApi.GetChannelBots``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
// response from `GetChannelBots`: []BotUser
fmt.Fprintf(os.Stdout, "Response from `ChannelApi.GetChannelBots`: %v\n", resp)
}
Name | Type | Description | Notes |
---|---|---|---|
ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. | |
channelId | string | チャンネルUUID |
Other parameters are passed through a pointer to a apiGetChannelBotsRequest struct via the builder pattern
Name | Type | Description | Notes |
---|
- Content-Type: Not defined
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
[]ChannelEvent GetChannelEvents(ctx, channelId).Limit(limit).Offset(offset).Since(since).Until(until).Inclusive(inclusive).Order(order).Execute()
チャンネルイベントのリストを取得
package main
import (
"context"
"fmt"
"os"
"time"
traq "github.com/traPtitech/go-traq"
)
func main() {
channelId := "38400000-8cf0-11bd-b23e-10b96e4ef00d" // string | チャンネルUUID
limit := int32(50) // int32 | 取得する件数 (optional)
offset := int32(150) // int32 | 取得するオフセット (optional) (default to 0)
since := time.Now() // time.Time | 取得する時間範囲の開始日時 (optional) (default to "0000-01-01T00:00Z")
until := time.Now() // time.Time | 取得する時間範囲の終了日時 (optional)
inclusive := true // bool | 範囲の端を含めるかどうか (optional) (default to false)
order := "order_example" // string | 昇順か降順か (optional) (default to "desc")
configuration := traq.NewConfiguration()
apiClient := traq.NewAPIClient(configuration)
resp, r, err := apiClient.ChannelApi.GetChannelEvents(context.Background(), channelId).Limit(limit).Offset(offset).Since(since).Until(until).Inclusive(inclusive).Order(order).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `ChannelApi.GetChannelEvents``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
// response from `GetChannelEvents`: []ChannelEvent
fmt.Fprintf(os.Stdout, "Response from `ChannelApi.GetChannelEvents`: %v\n", resp)
}
Name | Type | Description | Notes |
---|---|---|---|
ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. | |
channelId | string | チャンネルUUID |
Other parameters are passed through a pointer to a apiGetChannelEventsRequest struct via the builder pattern
Name | Type | Description | Notes |
---|
limit | int32 | 取得する件数 | offset | int32 | 取得するオフセット | [default to 0] since | time.Time | 取得する時間範囲の開始日時 | [default to "0000-01-01T00:00Z"] until | time.Time | 取得する時間範囲の終了日時 | inclusive | bool | 範囲の端を含めるかどうか | [default to false] order | string | 昇順か降順か | [default to "desc"]
- Content-Type: Not defined
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
ChannelPath GetChannelPath(ctx, channelId).Execute()
指定したチャンネルパスを取得
package main
import (
"context"
"fmt"
"os"
traq "github.com/traPtitech/go-traq"
)
func main() {
channelId := "38400000-8cf0-11bd-b23e-10b96e4ef00d" // string | チャンネルUUID
configuration := traq.NewConfiguration()
apiClient := traq.NewAPIClient(configuration)
resp, r, err := apiClient.ChannelApi.GetChannelPath(context.Background(), channelId).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `ChannelApi.GetChannelPath``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
// response from `GetChannelPath`: ChannelPath
fmt.Fprintf(os.Stdout, "Response from `ChannelApi.GetChannelPath`: %v\n", resp)
}
Name | Type | Description | Notes |
---|---|---|---|
ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. | |
channelId | string | チャンネルUUID |
Other parameters are passed through a pointer to a apiGetChannelPathRequest struct via the builder pattern
Name | Type | Description | Notes |
---|
- Content-Type: Not defined
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
[]Pin GetChannelPins(ctx, channelId).Execute()
チャンネルピンのリストを取得
package main
import (
"context"
"fmt"
"os"
traq "github.com/traPtitech/go-traq"
)
func main() {
channelId := "38400000-8cf0-11bd-b23e-10b96e4ef00d" // string | チャンネルUUID
configuration := traq.NewConfiguration()
apiClient := traq.NewAPIClient(configuration)
resp, r, err := apiClient.ChannelApi.GetChannelPins(context.Background(), channelId).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `ChannelApi.GetChannelPins``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
// response from `GetChannelPins`: []Pin
fmt.Fprintf(os.Stdout, "Response from `ChannelApi.GetChannelPins`: %v\n", resp)
}
Name | Type | Description | Notes |
---|---|---|---|
ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. | |
channelId | string | チャンネルUUID |
Other parameters are passed through a pointer to a apiGetChannelPinsRequest struct via the builder pattern
Name | Type | Description | Notes |
---|
- Content-Type: Not defined
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
ChannelStats GetChannelStats(ctx, channelId).Execute()
チャンネル統計情報を取得
package main
import (
"context"
"fmt"
"os"
traq "github.com/traPtitech/go-traq"
)
func main() {
channelId := "38400000-8cf0-11bd-b23e-10b96e4ef00d" // string | チャンネルUUID
configuration := traq.NewConfiguration()
apiClient := traq.NewAPIClient(configuration)
resp, r, err := apiClient.ChannelApi.GetChannelStats(context.Background(), channelId).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `ChannelApi.GetChannelStats``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
// response from `GetChannelStats`: ChannelStats
fmt.Fprintf(os.Stdout, "Response from `ChannelApi.GetChannelStats`: %v\n", resp)
}
Name | Type | Description | Notes |
---|---|---|---|
ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. | |
channelId | string | チャンネルUUID |
Other parameters are passed through a pointer to a apiGetChannelStatsRequest struct via the builder pattern
Name | Type | Description | Notes |
---|
- Content-Type: Not defined
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
[]string GetChannelSubscribers(ctx, channelId).Execute()
チャンネルの通知購読者のリストを取得
package main
import (
"context"
"fmt"
"os"
traq "github.com/traPtitech/go-traq"
)
func main() {
channelId := "38400000-8cf0-11bd-b23e-10b96e4ef00d" // string | チャンネルUUID
configuration := traq.NewConfiguration()
apiClient := traq.NewAPIClient(configuration)
resp, r, err := apiClient.ChannelApi.GetChannelSubscribers(context.Background(), channelId).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `ChannelApi.GetChannelSubscribers``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
// response from `GetChannelSubscribers`: []string
fmt.Fprintf(os.Stdout, "Response from `ChannelApi.GetChannelSubscribers`: %v\n", resp)
}
Name | Type | Description | Notes |
---|---|---|---|
ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. | |
channelId | string | チャンネルUUID |
Other parameters are passed through a pointer to a apiGetChannelSubscribersRequest struct via the builder pattern
Name | Type | Description | Notes |
---|
[]string
- Content-Type: Not defined
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
ChannelTopic GetChannelTopic(ctx, channelId).Execute()
チャンネルトピックを取得
package main
import (
"context"
"fmt"
"os"
traq "github.com/traPtitech/go-traq"
)
func main() {
channelId := "38400000-8cf0-11bd-b23e-10b96e4ef00d" // string | チャンネルUUID
configuration := traq.NewConfiguration()
apiClient := traq.NewAPIClient(configuration)
resp, r, err := apiClient.ChannelApi.GetChannelTopic(context.Background(), channelId).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `ChannelApi.GetChannelTopic``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
// response from `GetChannelTopic`: ChannelTopic
fmt.Fprintf(os.Stdout, "Response from `ChannelApi.GetChannelTopic`: %v\n", resp)
}
Name | Type | Description | Notes |
---|---|---|---|
ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. | |
channelId | string | チャンネルUUID |
Other parameters are passed through a pointer to a apiGetChannelTopicRequest struct via the builder pattern
Name | Type | Description | Notes |
---|
- Content-Type: Not defined
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
[]ChannelViewer GetChannelViewers(ctx, channelId).Execute()
チャンネル閲覧者リストを取得
package main
import (
"context"
"fmt"
"os"
traq "github.com/traPtitech/go-traq"
)
func main() {
channelId := "38400000-8cf0-11bd-b23e-10b96e4ef00d" // string | チャンネルUUID
configuration := traq.NewConfiguration()
apiClient := traq.NewAPIClient(configuration)
resp, r, err := apiClient.ChannelApi.GetChannelViewers(context.Background(), channelId).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `ChannelApi.GetChannelViewers``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
// response from `GetChannelViewers`: []ChannelViewer
fmt.Fprintf(os.Stdout, "Response from `ChannelApi.GetChannelViewers`: %v\n", resp)
}
Name | Type | Description | Notes |
---|---|---|---|
ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. | |
channelId | string | チャンネルUUID |
Other parameters are passed through a pointer to a apiGetChannelViewersRequest struct via the builder pattern
Name | Type | Description | Notes |
---|
- Content-Type: Not defined
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
ChannelList GetChannels(ctx).IncludeDm(includeDm).Path(path).Execute()
チャンネルリストを取得
package main
import (
"context"
"fmt"
"os"
traq "github.com/traPtitech/go-traq"
)
func main() {
includeDm := true // bool | ダイレクトメッセージチャンネルをレスポンスに含めるかどうか (optional) (default to false)
path := "path_example" // string | パスが一致するチャンネルのみを取得する (optional)
configuration := traq.NewConfiguration()
apiClient := traq.NewAPIClient(configuration)
resp, r, err := apiClient.ChannelApi.GetChannels(context.Background()).IncludeDm(includeDm).Path(path).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `ChannelApi.GetChannels``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
// response from `GetChannels`: ChannelList
fmt.Fprintf(os.Stdout, "Response from `ChannelApi.GetChannels`: %v\n", resp)
}
Other parameters are passed through a pointer to a apiGetChannelsRequest struct via the builder pattern
Name | Type | Description | Notes |
---|---|---|---|
includeDm | bool | ダイレクトメッセージチャンネルをレスポンスに含めるかどうか | [default to false] |
path | string | パスが一致するチャンネルのみを取得する |
- Content-Type: Not defined
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
[]Message GetMessages(ctx, channelId).Limit(limit).Offset(offset).Since(since).Until(until).Inclusive(inclusive).Order(order).Execute()
チャンネルメッセージのリストを取得
package main
import (
"context"
"fmt"
"os"
"time"
traq "github.com/traPtitech/go-traq"
)
func main() {
channelId := "38400000-8cf0-11bd-b23e-10b96e4ef00d" // string | チャンネルUUID
limit := int32(50) // int32 | 取得する件数 (optional)
offset := int32(150) // int32 | 取得するオフセット (optional) (default to 0)
since := time.Now() // time.Time | 取得する時間範囲の開始日時 (optional) (default to "0000-01-01T00:00Z")
until := time.Now() // time.Time | 取得する時間範囲の終了日時 (optional)
inclusive := true // bool | 範囲の端を含めるかどうか (optional) (default to false)
order := "order_example" // string | 昇順か降順か (optional) (default to "desc")
configuration := traq.NewConfiguration()
apiClient := traq.NewAPIClient(configuration)
resp, r, err := apiClient.ChannelApi.GetMessages(context.Background(), channelId).Limit(limit).Offset(offset).Since(since).Until(until).Inclusive(inclusive).Order(order).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `ChannelApi.GetMessages``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
// response from `GetMessages`: []Message
fmt.Fprintf(os.Stdout, "Response from `ChannelApi.GetMessages`: %v\n", resp)
}
Name | Type | Description | Notes |
---|---|---|---|
ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. | |
channelId | string | チャンネルUUID |
Other parameters are passed through a pointer to a apiGetMessagesRequest struct via the builder pattern
Name | Type | Description | Notes |
---|
limit | int32 | 取得する件数 | offset | int32 | 取得するオフセット | [default to 0] since | time.Time | 取得する時間範囲の開始日時 | [default to "0000-01-01T00:00Z"] until | time.Time | 取得する時間範囲の終了日時 | inclusive | bool | 範囲の端を含めるかどうか | [default to false] order | string | 昇順か降順か | [default to "desc"]
- Content-Type: Not defined
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
DMChannel GetUserDMChannel(ctx, userId).Execute()
DMチャンネル情報を取得
package main
import (
"context"
"fmt"
"os"
traq "github.com/traPtitech/go-traq"
)
func main() {
userId := "38400000-8cf0-11bd-b23e-10b96e4ef00d" // string |
configuration := traq.NewConfiguration()
apiClient := traq.NewAPIClient(configuration)
resp, r, err := apiClient.ChannelApi.GetUserDMChannel(context.Background(), userId).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `ChannelApi.GetUserDMChannel``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
// response from `GetUserDMChannel`: DMChannel
fmt.Fprintf(os.Stdout, "Response from `ChannelApi.GetUserDMChannel`: %v\n", resp)
}
Name | Type | Description | Notes |
---|---|---|---|
ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. | |
userId | string |
Other parameters are passed through a pointer to a apiGetUserDMChannelRequest struct via the builder pattern
Name | Type | Description | Notes |
---|
- Content-Type: Not defined
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
Message PostMessage(ctx, channelId).PostMessageRequest(postMessageRequest).Execute()
チャンネルにメッセージを投稿
package main
import (
"context"
"fmt"
"os"
traq "github.com/traPtitech/go-traq"
)
func main() {
channelId := "38400000-8cf0-11bd-b23e-10b96e4ef00d" // string | チャンネルUUID
postMessageRequest := *traq.NewPostMessageRequest("Content_example") // PostMessageRequest | (optional)
configuration := traq.NewConfiguration()
apiClient := traq.NewAPIClient(configuration)
resp, r, err := apiClient.ChannelApi.PostMessage(context.Background(), channelId).PostMessageRequest(postMessageRequest).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `ChannelApi.PostMessage``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
// response from `PostMessage`: Message
fmt.Fprintf(os.Stdout, "Response from `ChannelApi.PostMessage`: %v\n", resp)
}
Name | Type | Description | Notes |
---|---|---|---|
ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. | |
channelId | string | チャンネルUUID |
Other parameters are passed through a pointer to a apiPostMessageRequest struct via the builder pattern
Name | Type | Description | Notes |
---|
postMessageRequest | PostMessageRequest | |
- Content-Type: application/json
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
SetChannelSubscribers(ctx, channelId).PutChannelSubscribersRequest(putChannelSubscribersRequest).Execute()
チャンネルの通知購読者を設定
package main
import (
"context"
"fmt"
"os"
traq "github.com/traPtitech/go-traq"
)
func main() {
channelId := "38400000-8cf0-11bd-b23e-10b96e4ef00d" // string | チャンネルUUID
putChannelSubscribersRequest := *traq.NewPutChannelSubscribersRequest([]string{"On_example"}) // PutChannelSubscribersRequest | (optional)
configuration := traq.NewConfiguration()
apiClient := traq.NewAPIClient(configuration)
r, err := apiClient.ChannelApi.SetChannelSubscribers(context.Background(), channelId).PutChannelSubscribersRequest(putChannelSubscribersRequest).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `ChannelApi.SetChannelSubscribers``: %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. | |
channelId | string | チャンネルUUID |
Other parameters are passed through a pointer to a apiSetChannelSubscribersRequest struct via the builder pattern
Name | Type | Description | Notes |
---|
putChannelSubscribersRequest | PutChannelSubscribersRequest | |
(empty response body)
- Content-Type: application/json
- Accept: Not defined
[Back to top] [Back to API list] [Back to Model list] [Back to README]