createPostsWithHttpInfo method
POST /companies/{company_id}/posts
Note: This method returns the HTTP Response.
Parameters:
-
String companyId (required): Unique identifier for the Company
-
PostsInput postsInput (required):
-
int page: Page number for pagination
-
int limit: Number of items per page
-
String sortBy: Field to sort by
-
String sortOrder: Sort order (ascending or descending)
-
String search: Search term to filter results
Implementation
Future<Response> createPostsWithHttpInfo(String companyId, PostsInput postsInput, { int? page, int? limit, String? sortBy, String? sortOrder, String? search, }) async {
// ignore: prefer_const_declarations
final path = r'/companies/{company_id}/posts'
.replaceAll('{company_id}', companyId);
// ignore: prefer_final_locals
Object? postBody = postsInput;
final queryParams = <QueryParam>[];
final headerParams = <String, String>{};
final formParams = <String, String>{};
if (page != null) {
queryParams.addAll(_queryParams('', 'page', page));
}
if (limit != null) {
queryParams.addAll(_queryParams('', 'limit', limit));
}
if (sortBy != null) {
queryParams.addAll(_queryParams('', 'sort_by', sortBy));
}
if (sortOrder != null) {
queryParams.addAll(_queryParams('', 'sort_order', sortOrder));
}
if (search != null) {
queryParams.addAll(_queryParams('', 'search', search));
}
const contentTypes = <String>['application/json'];
return apiClient.invokeAPI(
path,
'POST',
queryParams,
postBody,
headerParams,
formParams,
contentTypes.isEmpty ? null : contentTypes.first,
);
}