LCOV - code coverage report
Current view: top level - lib/src - contenttype_query.dart (source / functions) Hit Total Coverage
Test: lcov.info Lines: 12 12 100.0 %
Date: 2020-05-04 13:08:30 Functions: 0 0 -

          Line data    Source code
       1             : import 'dart:async';
       2             : import 'package:contentstack/client.dart';
       3             : import 'package:contentstack/src/base_query.dart';
       4             : 
       5             : ///
       6             : /// This call facilitate to apply query on the contenttype.
       7             : ///
       8             : class ContentTypeQuery extends BaseQuery {
       9             :   final HttpClient _client;
      10             :   String _urlPath;
      11             : 
      12           1 :   ContentTypeQuery([this._client]) {
      13           5 :     queryParameter['environment'] = _client.stackHeaders['environment'];
      14           5 :     _urlPath = '/${_client.stack.apiVersion}/content_types';
      15             :   }
      16             : 
      17             :   ///
      18             :   /// includeCount method facilitate to find the total count of
      19             :   /// content types available in your stack
      20             :   ///
      21             :   /// Example:
      22             :   /// final stack = contentstack.Stack('apiKey', 'deliveryToken', 'environment');
      23             :   /// final contentTypeQuery = stack.contentType().query()
      24             :   /// final response = contentTypeQuery.includeCount().find();
      25             :   /// print(response);
      26             :   ///
      27           1 :   void includeCount() {
      28           2 :     queryParameter['include_count'] = 'true';
      29             :   }
      30             : 
      31           1 :   void includeGlobalField() {
      32           2 :     queryParameter['include_count'] = 'true';
      33             :   }
      34             : 
      35             :   /// This call returns comprehensive information of all the content types
      36             :   /// available in a particular stack in your account.
      37             :   ///
      38             :   /// Example:
      39             :   /// final stack = contentstack.Stack('apiKey', 'deliveryToken', 'environment');
      40             :   /// final contentTypeQuery = stack.contentType().query()
      41             :   /// final response = contentTypeQuery.includeCount().find();
      42             :   /// print(response);
      43           1 :   Future<T> find<T, K>({Map<String, String> queryParams}) async {
      44           1 :     if (queryParams != null && queryParams.isNotEmpty) {
      45           2 :       queryParameter.addAll(queryParams);
      46             :     }
      47           6 :     final uri = Uri.https(_client.stack.endpoint, _urlPath, queryParameter);
      48           2 :     return _client.sendRequest<T, K>(uri);
      49             :   }
      50             : }

Generated by: LCOV version 1.14