getPostsForChannelWithHttpInfo method
Get posts for a channel
Get a page of posts in a channel. Use the query parameters to modify the behaviour of this endpoint. The parameter since
must not be used with any of before
, after
, page
, and per_page
parameters. If since
is used, it will always return all posts modified since that time, ordered by their create time limited till 1000. A caveat with this parameter is that there is no guarantee that the returned posts will be consecutive. It is left to the clients to maintain state and fill any missing holes in the post order. ##### Permissions Must have read_channel
permission for the channel.
Note: This method returns the HTTP Response
.
Parameters:
-
String channelId (required): The channel ID to get the posts for
-
int page: The page to select
-
int perPage: The number of posts per page
-
int since: Provide a non-zero value in Unix time milliseconds to select posts modified after that time
-
String before: A post id to select the posts that came before this one
-
String after: A post id to select the posts that came after this one
Implementation
Future<Response> getPostsForChannelWithHttpInfo(
String channelId, {
int? page,
int? perPage,
int? since,
String? before,
String? after,
}) async {
// ignore: prefer_const_declarations
final path = r'/channels/{channel_id}/posts'.replaceAll('{channel_id}', channelId);
// ignore: prefer_final_locals
Object? postBody;
final queryParams = <MmQueryParam>[];
final headerParams = <String, String>{};
final formParams = <String, String>{};
if (page != null) {
queryParams.addAll(_queryParams('', 'page', page));
}
if (perPage != null) {
queryParams.addAll(_queryParams('', 'per_page', perPage));
}
if (since != null) {
queryParams.addAll(_queryParams('', 'since', since));
}
if (before != null) {
queryParams.addAll(_queryParams('', 'before', before));
}
if (after != null) {
queryParams.addAll(_queryParams('', 'after', after));
}
const contentTypes = <String>[];
return apiClient.invokeAPI(
path,
'GET',
queryParams,
postBody,
headerParams,
formParams,
contentTypes.isEmpty ? null : contentTypes.first,
);
}