github.com/google/go-github/v69@v69.2.0/github/emojis.go (about)

     1  // Copyright 2023 The go-github AUTHORS. All rights reserved.
     2  //
     3  // Use of this source code is governed by a BSD-style
     4  // license that can be found in the LICENSE file.
     5  
     6  package github
     7  
     8  import (
     9  	"context"
    10  )
    11  
    12  // EmojisService provides access to emoji-related functions in the GitHub API.
    13  type EmojisService service
    14  
    15  // List returns the emojis available to use on GitHub.
    16  //
    17  // GitHub API docs: https://docs.github.com/rest/emojis/emojis#get-emojis
    18  //
    19  //meta:operation GET /emojis
    20  func (s *EmojisService) List(ctx context.Context) (map[string]string, *Response, error) {
    21  	req, err := s.client.NewRequest("GET", "emojis", nil)
    22  	if err != nil {
    23  		return nil, nil, err
    24  	}
    25  
    26  	var emoji map[string]string
    27  	resp, err := s.client.Do(ctx, req, &emoji)
    28  	if err != nil {
    29  		return nil, resp, err
    30  	}
    31  
    32  	return emoji, resp, nil
    33  }
    34  
    35  // ListEmojis returns the emojis available to use on GitHub.
    36  //
    37  // Deprecated: Use EmojisService.List instead.
    38  func (c *Client) ListEmojis(ctx context.Context) (map[string]string, *Response, error) {
    39  	return c.Emojis.List(ctx)
    40  }