code: func (s *RepositoriesService) GetContents(ctx context.Context, owner, repo, path string, opt *RepositoryContentGetOptions) (fileContent *RepositoryContent, directoryContent []*RepositoryContent, resp *Response, err error) {
  	escapedPath := (&url.URL{Path: path}).String()
  	u := fmt.Sprintf("repos/%s/%s/contents/%s", owner, repo, escapedPath)
  	u, err = addOptions(u, opt)
  	if err != nil {
  		return nil, nil, nil, err
  	}
  	req, err := s.client.NewRequest("GET", u, nil)
  	if err != nil {
  		return nil, nil, nil, err
  	}
  	var rawJSON json.RawMessage
  	resp, err = s.client.Do(ctx, req, &rawJSON)
  	if err != nil {
  		return nil, nil, resp, err
  	}
  	fileUnmarshalError := json.Unmarshal(rawJSON, &fileContent)
  	if fileUnmarshalError == nil {
  		return fileContent, nil, resp, nil
  	}
  	directoryUnmarshalError := json.Unmarshal(rawJSON, &directoryContent)
  	if directoryUnmarshalError == nil {
  		return nil, directoryContent, resp, nil
  	}
  	return nil, nil, resp, fmt.Errorf("unmarshalling failed for both file and directory content: %s and %s", fileUnmarshalError, directoryUnmarshalError)
  }
docs: // GetContents can return either the metadata and content of a single file
  // (when path references a file) or the metadata of all the files and/or
  // subdirectories of a directory (when path references a directory). To make it
  // easy to distinguish between both result types and to mimic the API as much
  // as possible, both result types will be returned but only one will contain a
  // value and the other will be nil.
  //
  // GitHub API docs: https://developer.github.com/v3/repos/contents/#get-contents