createPostWithHttpInfo method

Future<Response> createPostWithHttpInfo(
  1. MmCreatePostRequest mmCreatePostRequest, {
  2. bool? setOnline,
})

Create a post

Create a new post in a channel. To create the post as a comment on another post, provide root_id. ##### Permissions Must have create_post permission for the channel the post is being created in.

Note: This method returns the HTTP Response.

Parameters:

  • MmCreatePostRequest mmCreatePostRequest (required): Post object to create

  • bool setOnline: Whether to set the user status as online or not.

Implementation

Future<Response> createPostWithHttpInfo(
  MmCreatePostRequest mmCreatePostRequest, {
  bool? setOnline,
}) async {
  // ignore: prefer_const_declarations
  final path = r'/posts';

  // ignore: prefer_final_locals
  Object? postBody = mmCreatePostRequest;

  final queryParams = <MmQueryParam>[];
  final headerParams = <String, String>{};
  final formParams = <String, String>{};

  if (setOnline != null) {
    queryParams.addAll(_queryParams('', 'set_online', setOnline));
  }

  const contentTypes = <String>['application/json'];

  return apiClient.invokeAPI(
    path,
    'POST',
    queryParams,
    postBody,
    headerParams,
    formParams,
    contentTypes.isEmpty ? null : contentTypes.first,
  );
}