github.com/line/line-bot-sdk-go/v7@v7.21.0/linebot/get_bot_info.go (about)

     1  // Copyright 2016 LINE Corporation
     2  //
     3  // LINE Corporation licenses this file to you under the Apache License,
     4  // version 2.0 (the "License"); you may not use this file except in compliance
     5  // with the License. You may obtain a copy of the License at:
     6  //
     7  //   http://www.apache.org/licenses/LICENSE-2.0
     8  //
     9  // Unless required by applicable law or agreed to in writing, software
    10  // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
    11  // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
    12  // License for the specific language governing permissions and limitations
    13  // under the License.
    14  
    15  package linebot
    16  
    17  import (
    18  	"context"
    19  )
    20  
    21  // ChatMode type
    22  type ChatMode string
    23  
    24  // ChatMode constants
    25  const (
    26  	ChatModeChat ChatMode = "chat"
    27  	ChatModeBot  ChatMode = "bot"
    28  )
    29  
    30  // MarkAsReadMode type
    31  type MarkAsReadMode string
    32  
    33  // MarkAsReadMode constants
    34  const (
    35  	MarkAsReadModeManual MarkAsReadMode = "manual"
    36  	MarkAsReadModeAuto   MarkAsReadMode = "auto"
    37  )
    38  
    39  // GetBotInfo method
    40  func (client *Client) GetBotInfo() *GetBotInfoCall {
    41  	return &GetBotInfoCall{
    42  		c:        client,
    43  		endpoint: APIEndpointGetBotInfo,
    44  	}
    45  }
    46  
    47  // WithContext method
    48  func (call *GetBotInfoCall) WithContext(ctx context.Context) *GetBotInfoCall {
    49  	call.ctx = ctx
    50  	return call
    51  }
    52  
    53  // Do method
    54  func (call *GetBotInfoCall) Do() (*BotInfoResponse, error) {
    55  	res, err := call.c.get(call.ctx, call.c.endpointBase, call.endpoint, nil)
    56  	if err != nil {
    57  		return nil, err
    58  	}
    59  	defer closeResponse(res)
    60  	return decodeToBotInfoResponse(res)
    61  }
    62  
    63  // GetBotInfoCall type
    64  type GetBotInfoCall struct {
    65  	c        *Client
    66  	ctx      context.Context
    67  	endpoint string
    68  }