Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Uses nulab.com for API docs URL #58

Merged
merged 1 commit into from
Dec 16, 2019
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
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ go-typetalk
[coveralls]: https://coveralls.io/github/nulab/go-typetalk?branch=master
[godocs]: http://godoc.org/github.com/nulab/go-typetalk

go-typetalk is a GO client library for accessing the [Typetalk API](http://developer.nulab-inc.com/docs/typetalk).
go-typetalk is a GO client library for accessing the [Typetalk API](https://developer.nulab.com/docs/typetalk).

## Prerequisite

To use this library, you must have a valid [client id and client secret](https://developer.nulab-inc.com/docs/typetalk/auth#oauth2) provided by Typetalk and register a new client application. Or you can use the [Typetalk Token](https://developer.nulab-inc.com/docs/typetalk/auth#tttoken).
To use this library, you must have a valid [client id and client secret](https://developer.nulab.com/docs/typetalk/auth#oauth2) provided by Typetalk and register a new client application. Or you can use the [Typetalk Token](https://developer.nulab.com/docs/typetalk/auth#tttoken).

## Usage

Expand Down
12 changes: 6 additions & 6 deletions testdata/v2/get-notification-count.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"key": "xxxxxxxxx",
"name": "Awesome Tech Inc.",
"enabled": true,
"imageUrl": "https://dev.apps.nulab-inc.com/spaces/xxxxxxxxx/photo/large"
"imageUrl": "https://apps.nulab-inc.com/spaces/xxxxxxxxx/photo/large"
},
"myRole": "ADMIN",
"isPaymentAdmin": true,
Expand Down Expand Up @@ -34,7 +34,7 @@
"key": "xxxxxxxxx",
"name": "Awesome Tech Inc.",
"enabled": true,
"imageUrl": "https://dev.apps.nulab-inc.com/spaces/xxxxxxxxx/photo/large"
"imageUrl": "https://apps.nulab-inc.com/spaces/xxxxxxxxx/photo/large"
},
"access": {
"unopened": 0,
Expand All @@ -56,7 +56,7 @@
"key": "xxxxxxxxx",
"name": "Example Organization",
"enabled": true,
"imageUrl": "https://dev.apps.nulab-inc.com/spaces/xxxxxxxxx/photo/large"
"imageUrl": "https://apps.nulab-inc.com/spaces/xxxxxxxxx/photo/large"
},
"myRole": "ADMIN",
"isPaymentAdmin": true,
Expand Down Expand Up @@ -87,7 +87,7 @@
"key": "xxxxxxxxx",
"name": "Example Organization",
"enabled": true,
"imageUrl": "https://dev.apps.nulab-inc.com/spaces/xxxxxxxxx/photo/large"
"imageUrl": "https://apps.nulab-inc.com/spaces/xxxxxxxxx/photo/large"
},
"access": {
"unopened": 0,
Expand All @@ -109,7 +109,7 @@
"key": "xxxxxxxxx",
"name": "Fabulous Tech Inc.",
"enabled": true,
"imageUrl": "https://dev.apps.nulab-inc.com/spaces/xxxxxxxxx/photo/large"
"imageUrl": "https://apps.nulab-inc.com/spaces/xxxxxxxxx/photo/large"
},
"myRole": "ADMIN",
"isPaymentAdmin": true,
Expand Down Expand Up @@ -137,7 +137,7 @@
"key": "xxxxxxxxx",
"name": "Fabulous Tech Inc.",
"enabled": true,
"imageUrl": "https://dev.apps.nulab-inc.com/spaces/xxxxxxxxx/photo/large"
"imageUrl": "https://apps.nulab-inc.com/spaces/xxxxxxxxx/photo/large"
},
"access": {
"unopened": 0,
Expand Down
6 changes: 3 additions & 3 deletions typetalk/v1/accounts.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ type OnlineStatus struct {

// GetMyProfile fetches the user's account information.
//
// Typetalk API docs: https://developer.nulab-inc.com/docs/typetalk/api/1/get-profile
// Typetalk API docs: https://developer.nulab.com/docs/typetalk/api/1/get-profile
func (s *AccountsService) GetMyProfile(ctx context.Context) (*MyProfile, *shared.Response, error) {
u := "profile"
var result *MyProfile
Expand All @@ -80,7 +80,7 @@ func (s *AccountsService) GetMyProfile(ctx context.Context) (*MyProfile, *shared

// GetFriendProfile fetches other user's account information.
//
// Typetalk API docs: https://developer.nulab-inc.com/docs/typetalk/api/1/get-friend-profile
// Typetalk API docs: https://developer.nulab.com/docs/typetalk/api/1/get-friend-profile
func (s *AccountsService) GetFriendProfile(ctx context.Context, accountName string) (*Profile, *shared.Response, error) {
u := fmt.Sprintf("profile/%s", accountName)
var result *Profile
Expand Down Expand Up @@ -140,7 +140,7 @@ type getOnlineStatusOptions struct {

// GetOnlineStatus fetches an user's online status.
//
// Typetalk API docs: https://developer.nulab-inc.com/docs/typetalk/api/1/get-online-status
// Typetalk API docs: https://developer.nulab.com/docs/typetalk/api/1/get-online-status
func (s *AccountsService) GetOnlineStatus(ctx context.Context, accountIds ...int) (*OnlineStatus, *shared.Response, error) {
u, err := internal.AddQueries("accounts/status", &getOnlineStatusOptions{accountIds})
if err != nil {
Expand Down
4 changes: 2 additions & 2 deletions typetalk/v1/files.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ type AttachmentFile struct {

// UploadAttachmentFile uploads attachment file.
//
// Typetalk API docs: https://developer.nulab-inc.com/docs/typetalk/api/1/upload-attachment
// Typetalk API docs: https://developer.nulab.com/docs/typetalk/api/1/upload-attachment
func (s *FilesService) UploadAttachmentFile(ctx context.Context, topicID int, file *os.File) (*AttachmentFile, *shared.Response, error) {
u := fmt.Sprintf("topics/%v/attachments", topicID)
stat, err := file.Stat()
Expand Down Expand Up @@ -51,7 +51,7 @@ func (s *FilesService) UploadAttachmentFile(ctx context.Context, topicID int, fi

// DownloadAttachmentFile downloads attachment file.
//
// Typetalk API docs: https://developer.nulab-inc.com/docs/typetalk/api/1/download-attachment
// Typetalk API docs: https://developer.nulab.com/docs/typetalk/api/1/download-attachment
func (s *FilesService) DownloadAttachmentFile(ctx context.Context, topicID, postID, attachmentID int, filename string) (io.ReadCloser, error) {
u := fmt.Sprintf("topics/%d/posts/%d/attachments/%d/%s", topicID, postID, attachmentID, filename)

Expand Down
8 changes: 4 additions & 4 deletions typetalk/v1/likes.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ type GetLikesOptions struct {

// GetLikesReceive fetches received likes list.
//
// Typetalk API docs: https://developer.nulab-inc.com/docs/typetalk/api/1/get-likes-receive/
// Typetalk API docs: https://developer.nulab.com/docs/typetalk/api/1/get-likes-receive/
func (s *LikesService) GetLikesReceive(ctx context.Context, opt *GetLikesOptions) ([]*ReceiveLikedPost, *shared.Response, error) {
u, err := internal.AddQueries("likes/receive", opt)
if err != nil {
Expand All @@ -59,7 +59,7 @@ func (s *LikesService) GetLikesReceive(ctx context.Context, opt *GetLikesOptions

// GetLikesGive fetches given likes list. Those likes are given by your account.
//
// Typetalk API docs: https://developer.nulab-inc.com/docs/typetalk/api/1/get-likes-give/
// Typetalk API docs: https://developer.nulab.com/docs/typetalk/api/1/get-likes-give/
func (s *LikesService) GetLikesGive(ctx context.Context, opt *GetLikesOptions) ([]*GiveLikedPost, *shared.Response, error) {
u, err := internal.AddQueries("likes/give", opt)
if err != nil {
Expand All @@ -77,7 +77,7 @@ func (s *LikesService) GetLikesGive(ctx context.Context, opt *GetLikesOptions) (

// GetLikesDiscover fetches given likes list. Those likes are given by all the accounts.
//
// Typetalk API docs: https://developer.nulab-inc.com/docs/typetalk/api/1/get-likes-discover/
// Typetalk API docs: https://developer.nulab.com/docs/typetalk/api/1/get-likes-discover/
func (s *LikesService) GetLikesDiscover(ctx context.Context, opt *GetLikesOptions) ([]*DiscoverLikedPost, *shared.Response, error) {
u, err := internal.AddQueries("likes/discover", opt)
if err != nil {
Expand Down Expand Up @@ -108,7 +108,7 @@ type ReadReceivedLikesResult struct {

// ReadReceivedLikes marks likes as read.
//
// Typetalk API docs: https://developer.nulab-inc.com/docs/typetalk/api/1/save-read-likes/
// Typetalk API docs: https://developer.nulab.com/docs/typetalk/api/1/save-read-likes/
func (s *LikesService) ReadReceivedLikes(ctx context.Context, likeID int) (*ReadReceivedLikesResult, *shared.Response, error) {
u := "likes/receive/bookmark/save"

Expand Down
4 changes: 2 additions & 2 deletions typetalk/v1/mentions.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ type Mention struct {

// ReadMention marks a mention as read.
//
// Typetalk API docs: https://developer.nulab-inc.com/docs/typetalk/api/1/save-read-mention
// Typetalk API docs: https://developer.nulab.com/docs/typetalk/api/1/save-read-mention
func (s *MentionsService) ReadMention(ctx context.Context, mentionID int) (*Mention, *shared.Response, error) {
u := fmt.Sprintf("mentions/%d", mentionID)
var result *struct {
Expand All @@ -39,7 +39,7 @@ type GetMentionListOptions struct {

// GetMentionList fetches mentions list.
//
// Typetalk API docs: https://developer.nulab-inc.com/docs/typetalk/api/1/get-mentions
// Typetalk API docs: https://developer.nulab.com/docs/typetalk/api/1/get-mentions
func (s *MentionsService) GetMentionList(ctx context.Context, opt *GetMentionListOptions) ([]*Mention, *shared.Response, error) {
u, err := internal.AddQueries("mentions", opt)
if err != nil {
Expand Down
12 changes: 6 additions & 6 deletions typetalk/v1/messages.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ type postMessageOptions struct {

// PostMessage posts a message.
//
// Typetalk API docs: https://developer.nulab-inc.com/docs/typetalk/api/1/post-message
// Typetalk API docs: https://developer.nulab.com/docs/typetalk/api/1/post-message
func (s *MessagesService) PostMessage(ctx context.Context, topicID int, message string, opt *PostMessageOptions) (*PostedMessageResult, *shared.Response, error) {
u := fmt.Sprintf("topics/%v", topicID)
if opt == nil {
Expand All @@ -120,7 +120,7 @@ type updateMessageOptions struct {

// UpdateMessage updates a message.
//
// Typetalk API docs: https://developer.nulab-inc.com/docs/typetalk/api/1/update-message
// Typetalk API docs: https://developer.nulab.com/docs/typetalk/api/1/update-message
func (s *MessagesService) UpdateMessage(ctx context.Context, topicID, postID int, message string) (*UpdatedMessageResult, *shared.Response, error) {
u := fmt.Sprintf("topics/%d/posts/%d", topicID, postID)
var result *UpdatedMessageResult
Expand All @@ -133,7 +133,7 @@ func (s *MessagesService) UpdateMessage(ctx context.Context, topicID, postID int

// DeleteMessage deletes a message.
//
// Typetalk API docs: https://developer.nulab-inc.com/docs/typetalk/api/1/delete-message
// Typetalk API docs: https://developer.nulab.com/docs/typetalk/api/1/delete-message
func (s *MessagesService) DeleteMessage(ctx context.Context, topicID, postID int) (*Post, *shared.Response, error) {
u := fmt.Sprintf("topics/%d/posts/%d", topicID, postID)
var result *Post
Expand All @@ -146,7 +146,7 @@ func (s *MessagesService) DeleteMessage(ctx context.Context, topicID, postID int

// GetMessage gets a message.
//
// Typetalk API docs: https://developer.nulab-inc.com/docs/typetalk/api/1/get-message
// Typetalk API docs: https://developer.nulab.com/docs/typetalk/api/1/get-message
func (s *MessagesService) GetMessage(ctx context.Context, topicID, postID int) (*Message, *shared.Response, error) {
u := fmt.Sprintf("topics/%d/posts/%d", topicID, postID)
var result *Message
Expand All @@ -159,7 +159,7 @@ func (s *MessagesService) GetMessage(ctx context.Context, topicID, postID int) (

// LikeMessage marks a message as liked.
//
// Typetalk API docs: https://developer.nulab-inc.com/ja/docs/typetalk/api/1/favorite-topic
// Typetalk API docs: https://developer.nulab.com/ja/docs/typetalk/api/1/favorite-topic
func (s *MessagesService) LikeMessage(ctx context.Context, topicID, postID int) (*LikedMessageResult, *shared.Response, error) {
u := fmt.Sprintf("topics/%d/posts/%d/like", topicID, postID)
var result *LikedMessageResult
Expand All @@ -172,7 +172,7 @@ func (s *MessagesService) LikeMessage(ctx context.Context, topicID, postID int)

// UnlikeMessage marks a message as unliked.
//
// Typetalk API docs: https://developer.nulab-inc.com/ja/docs/typetalk/api/1/unfavorite-topic
// Typetalk API docs: https://developer.nulab.com/ja/docs/typetalk/api/1/unfavorite-topic
func (s *MessagesService) UnlikeMessage(ctx context.Context, topicID, postID int) (*Like, *shared.Response, error) {
u := fmt.Sprintf("topics/%d/posts/%d/like", topicID, postID)
var result *struct {
Expand Down
4 changes: 2 additions & 2 deletions typetalk/v1/notifications.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ type NotificationCount struct {

// GetNotificationList fetches notifications list.
//
// Typetalk API docs: https://developer.nulab-inc.com/docs/typetalk/api/1/get-notifications
// Typetalk API docs: https://developer.nulab.com/docs/typetalk/api/1/get-notifications
func (s *NotificationsService) GetNotificationList(ctx context.Context) (*NotificationList, *shared.Response, error) {
u := "notifications"
var result *NotificationList
Expand All @@ -58,7 +58,7 @@ func (s *NotificationsService) GetNotificationList(ctx context.Context) (*Notifi

// GetNotificationCount fetches notification counts.
//
// Typetalk API docs: https://developer.nulab-inc.com/docs/typetalk/api/1/get-notification-status
// Typetalk API docs: https://developer.nulab.com/docs/typetalk/api/1/get-notification-status
func (s *NotificationsService) GetNotificationCount(ctx context.Context) (*NotificationCount, *shared.Response, error) {
u := "notifications/status"
var result *NotificationCount
Expand Down
4 changes: 2 additions & 2 deletions typetalk/v1/organizations.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ type organizationsGetOptions struct {

// GetMyOrganizations fetches organizations list.
//
// Typetalk API docs: https://developer.nulab-inc.com/docs/typetalk/api/1/get-spaces
// Typetalk API docs: https://developer.nulab.com/docs/typetalk/api/1/get-spaces
func (s *OrganizationsService) GetMyOrganizations(ctx context.Context, excludesGuest bool) ([]*Organization, *shared.Response, error) {
u, err := internal.AddQueries("spaces", &organizationsGetOptions{excludesGuest})
if err != nil {
Expand All @@ -84,7 +84,7 @@ func (s *OrganizationsService) GetMyOrganizations(ctx context.Context, excludesG

// GetOrganizationMembers fetches an organization's members list.
//
// Typetalk API docs: https://developer.nulab-inc.com/docs/typetalk/api/1/get-space-members
// Typetalk API docs: https://developer.nulab.com/docs/typetalk/api/1/get-space-members
func (s *OrganizationsService) GetOrganizationMembers(ctx context.Context, spaceKey string) (*OrganizationMembers, *shared.Response, error) {
u := fmt.Sprintf("spaces/%s/members", spaceKey)
var result *OrganizationMembers
Expand Down
14 changes: 7 additions & 7 deletions typetalk/v1/talks.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ type CreateTalkOptions struct {

// CreateTalk creates a talk.
//
// Typetalk API docs: https://developer.nulab-inc.com/docs/typetalk/api/1/create-talk
// Typetalk API docs: https://developer.nulab.com/docs/typetalk/api/1/create-talk
func (s *TalksService) CreateTalk(ctx context.Context, topicID int, talkName string, postIds ...int) (*CreatedTalkResult, *shared.Response, error) {
u := fmt.Sprintf("topics/%d/talks", topicID)
var result *CreatedTalkResult
Expand All @@ -69,7 +69,7 @@ type updateTalkOptions struct {

// UpdateTalk updates a talk.
//
// Typetalk API docs: https://developer.nulab-inc.com/docs/typetalk/api/1/update-talk
// Typetalk API docs: https://developer.nulab.com/docs/typetalk/api/1/update-talk
func (s *TalksService) UpdateTalk(ctx context.Context, topicID, talkID int, talkName string) (*UpdatedTalkResult, *shared.Response, error) {
u, err := internal.AddQueries(fmt.Sprintf("topics/%d/talks/%d", topicID, talkID), &updateTalkOptions{talkName})
if err != nil {
Expand All @@ -86,7 +86,7 @@ func (s *TalksService) UpdateTalk(ctx context.Context, topicID, talkID int, talk

// DeleteTalk deletes a talk.
//
// Typetalk API docs: https://developer.nulab-inc.com/docs/typetalk/api/1/delete-talk
// Typetalk API docs: https://developer.nulab.com/docs/typetalk/api/1/delete-talk
func (s *TalksService) DeleteTalk(ctx context.Context, topicID, talkID int) (*DeletedTalkResult, *shared.Response, error) {
u := fmt.Sprintf("topics/%d/talks/%d", topicID, talkID)
var result *DeletedTalkResult
Expand All @@ -99,7 +99,7 @@ func (s *TalksService) DeleteTalk(ctx context.Context, topicID, talkID int) (*De

// GetTalkList fetches talks list.
//
// Typetalk API docs: https://developer.nulab-inc.com/docs/typetalk/api/1/get-talks
// Typetalk API docs: https://developer.nulab.com/docs/typetalk/api/1/get-talks
func (s *TalksService) GetTalkList(ctx context.Context, topicID int) ([]*Talk, *shared.Response, error) {
u := fmt.Sprintf("topics/%d/talks", topicID)
var result *struct {
Expand All @@ -114,7 +114,7 @@ func (s *TalksService) GetTalkList(ctx context.Context, topicID int) ([]*Talk, *

// GetMessagesInTalk fetches messages list in a talk.
//
// Typetalk API docs: https://developer.nulab-inc.com/docs/typetalk/api/1/get-talk
// Typetalk API docs: https://developer.nulab.com/docs/typetalk/api/1/get-talk
func (s *TalksService) GetMessagesInTalk(ctx context.Context, topicID, talkID int, opt *GetMessagesOptions) (*MessagesInTalk, *shared.Response, error) {
u, err := internal.AddQueries(fmt.Sprintf("topics/%d/talks/%d/posts", topicID, talkID), opt)
if err != nil {
Expand All @@ -134,7 +134,7 @@ type addMessageToTalkOptions struct {

// AddMessagesToTalk adds messages to a talk.
//
// Typetalk API docs: https://developer.nulab-inc.com/docs/typetalk/api/1/add-message-to-talk
// Typetalk API docs: https://developer.nulab.com/docs/typetalk/api/1/add-message-to-talk
func (s *TalksService) AddMessagesToTalk(ctx context.Context, topicID, talkID int, postIds ...int) (*MessagesInTalk, *shared.Response, error) {
u := fmt.Sprintf("topics/%d/talks/%d/posts", topicID, talkID)
var result *MessagesInTalk
Expand All @@ -149,7 +149,7 @@ type removeMessagesFromTalkOptions addMessageToTalkOptions

// RemoveMessagesFromTalk removes messages from a talk.
//
// Typetalk API docs: https://developer.nulab-inc.com/docs/typetalk/api/1/remove-message-from-talk
// Typetalk API docs: https://developer.nulab.com/docs/typetalk/api/1/remove-message-from-talk
func (s *TalksService) RemoveMessagesFromTalk(ctx context.Context, topicID, talkID int, postIds ...int) (*RemovedMessagesResult, *shared.Response, error) {
u, err := internal.AddQueries(fmt.Sprintf("topics/%d/talks/%d/posts", topicID, talkID), &removeMessagesFromTalkOptions{postIds})
if err != nil {
Expand Down
Loading