<commit_before>import type {
  UserID,
  Recipient,
  SendOption,
  Message,
  SendMessageSucessResponse,
} from './MessengerTypes';

export default class Messenger {
  static createRequest = (
    body: Object
  ): Promise<SendMessageSucessResponse> => ({
    method: 'POST',
    relative_url: 'me/messages',
    body,
  });

  static createMessage = (
    idOrRecipient: UserID | Recipient,
    message: Message,
    options?: SendOption
  ): Promise<SendMessageSucessResponse> => {
    const recipient =
      typeof idOrRecipient === 'string'
        ? {
            id: idOrRecipient,
          }
        : idOrRecipient;
    return Messenger.createRequest({
      recipient,
      message,
      ...options,
    });
  };

  static createText = (
    recipient: UserID | Recipient,
    text: string,
    options?: SendOption
  ) => Messenger.createMessage(recipient, { text }, options);
}
<commit_msg>use plain object instead of Messenger class<commit_after>import type {
  UserID,
  Recipient,
  SendOption,
  Message,
  BatchItem,
} from './MessengerTypes';

function createRequest(body: Object): BatchItem {
  return {
    method: 'POST',
    relative_url: 'me/messages',
    body,
  };
}

function createMessage(
  idOrRecipient: UserID | Recipient,
  message: Message,
  options?: SendOption
): BatchItem {
  const recipient =
    typeof idOrRecipient === 'string'
      ? {
          id: idOrRecipient,
        }
      : idOrRecipient;
  return createRequest({
    recipient,
    message,
    ...options,
  });
}

function createText(
  recipient: UserID | Recipient,
  text: string,
  options?: SendOption
): BatchItem {
  return createMessage(recipient, { text }, options);
}

const Messenger = {
  createRequest,
  createMessage,
  createText,
};

export default Messenger;

{'fraction_non_alphanumeric': 0.11241610738255034, 'fraction_numerical': 0.0, 'mean_word_length': 3.0112107623318387, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 8, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3948254', 'n_tokens_mistral': 567, 'n_tokens_neox': 547, 'n_words': 128}