// Create creates board by Board Request.
//
// API doc: https://developers.miro.com/reference#create-board
Create creates board by Board Request.


// Create creates board by Board Request . // // API doc : https : // developers . miro . com / reference#create - board
func (s *BoardsService) Create(ctx context.Context, b *CreateBoardRequest) (*Board, error) {
	req, err := s.client.NewPostRequest(boardsPath, b)
	if err != nil {
		return nil, err
	}
	resp, err := s.client.Do(ctx, req)
	if err != nil {
		return nil, err
	}
	defer resp.Body.Close()
	if resp.StatusCode != http.StatusCreated {
		respErr := &RespError{}
		if err := json.NewDecoder(resp.Body).Decode(respErr); err != nil {
			return nil, err
		}
		return nil, fmt.Errorf("status code not expected, got:%d, message:%s", resp.StatusCode, respErr.Message)
	}
	board := &Board{}
	if err := json.NewDecoder(resp.Body).Decode(board); err != nil {
		return nil, err
	}
	return board, nil
}
func ( s * BoardsService ) Create ( ctx context . Context , b * CreateBoardRequest ) ( * Board , error ) { req , err := s . client . NewPostRequest ( boardsPath , b ) if err != nil { return nil , err } resp , err := s . client . Do ( ctx , req ) if err != nil { return nil , err } defer resp . Body . Close ( ) if resp . StatusCode != http . StatusCreated { respErr := & RespError { } if err := json . NewDecoder ( resp . Body ) . Decode ( respErr ) ; err != nil { return nil , err } return nil , fmt . Errorf ( " " , resp . StatusCode , respErr . Message ) } board := & Board { } if err := json . NewDecoder ( resp . Body ) . Decode ( board ) ; err != nil { return nil , err } return board , nil }
Create creates board by Board Request.
Create creates board by Board Request .