Showing 1 of 4 files from the diff.
Other files ignored by Codecov

@@ -15,117 +15,121 @@
Loading
15 15
import 'package:flagr/api/segment_api.dart';
16 16
import 'package:flagr/api/variant_api.dart';
17 17
18 -
19 -
final _defaultInterceptors = [OAuthInterceptor(), BasicAuthInterceptor(), ApiKeyAuthInterceptor()];
18 +
final _defaultInterceptors = [
19 +
  OAuthInterceptor(),
20 +
  BasicAuthInterceptor(),
21 +
  ApiKeyAuthInterceptor()
22 +
];
20 23
21 24
class Flagr {
22 -
23 -
    Dio dio;
24 -
    Serializers serializers;
25 -
    String basePath = "http://localhost/api/v1";
26 -
27 -
    Flagr({this.dio, Serializers serializers, String basePathOverride, List<Interceptor> interceptors}) {
28 -
        if (dio == null) {
29 -
            BaseOptions options = new BaseOptions(
30 -
                baseUrl: basePathOverride ?? basePath,
31 -
                connectTimeout: 5000,
32 -
                receiveTimeout: 3000,
33 -
            );
34 -
            this.dio = new Dio(options);
35 -
        }
36 -
37 -
        if (interceptors == null) {
38 -
            this.dio.interceptors.addAll(_defaultInterceptors);
39 -
        } else {
40 -
            this.dio.interceptors.addAll(interceptors);
41 -
        }
42 -
43 -
        this.serializers = serializers ?? standardSerializers;
44 -
    }
45 -
46 -
    void setOAuthToken(String name, String token) {
47 -
        (this.dio.interceptors.firstWhere((element) => element is OAuthInterceptor, orElse: null) as OAuthInterceptor)?.tokens[name] = token;
48 -
    }
49 -
50 -
    void setBasicAuth(String name, String username, String password) {
51 -
        (this.dio.interceptors.firstWhere((element) => element is BasicAuthInterceptor, orElse: null) as BasicAuthInterceptor)?.authInfo[name] = BasicAuthInfo(username, password);
25 +
  Dio dio;
26 +
  Serializers serializers;
27 +
  String basePath = "http://localhost/api/v1";
28 +
29 +
  Flagr(
30 +
      {this.dio,
31 +
      Serializers serializers,
32 +
      String basePathOverride,
33 +
      List<Interceptor> interceptors}) {
34 +
    if (dio == null) {
35 +
      BaseOptions options = new BaseOptions(
36 +
        baseUrl: basePathOverride ?? basePath,
37 +
        connectTimeout: 5000,
38 +
        receiveTimeout: 3000,
39 +
      );
40 +
      this.dio = new Dio(options);
52 41
    }
53 42
54 -
    void setApiKey(String name, String apiKey) {
55 -
        (this.dio.interceptors.firstWhere((element) => element is ApiKeyAuthInterceptor, orElse: null) as ApiKeyAuthInterceptor)?.apiKeys[name] = apiKey;
43 +
    if (interceptors == null) {
44 +
      this.dio.interceptors.addAll(_defaultInterceptors);
45 +
    } else {
46 +
      this.dio.interceptors.addAll(interceptors);
56 47
    }
57 48
58 -
59 -
    /**
49 +
    this.serializers = serializers ?? standardSerializers;
50 +
  }
51 +
52 +
  void setOAuthToken(String name, String token) {
53 +
    (this.dio.interceptors.firstWhere((element) => element is OAuthInterceptor,
54 +
            orElse: null) as OAuthInterceptor)
55 +
        ?.tokens[name] = token;
56 +
  }
57 +
58 +
  void setBasicAuth(String name, String username, String password) {
59 +
    (this.dio.interceptors.firstWhere(
60 +
            (element) => element is BasicAuthInterceptor,
61 +
            orElse: null) as BasicAuthInterceptor)
62 +
        ?.authInfo[name] = BasicAuthInfo(username, password);
63 +
  }
64 +
65 +
  void setApiKey(String name, String apiKey) {
66 +
    (this.dio.interceptors.firstWhere(
67 +
            (element) => element is ApiKeyAuthInterceptor,
68 +
            orElse: null) as ApiKeyAuthInterceptor)
69 +
        ?.apiKeys[name] = apiKey;
70 +
  }
71 +
72 +
  /**
60 73
    * Get ConstraintApi instance, base route and serializer can be overridden by a given but be careful,
61 74
    * by doing that all interceptors will not be executed
62 75
    */
63 -
    ConstraintApi getConstraintApi() {
76 +
  ConstraintApi getConstraintApi() {
64 77
    return ConstraintApi(dio, serializers);
65 -
    }
66 -
78 +
  }
67 79
68 -
    /**
80 +
  /**
69 81
    * Get DistributionApi instance, base route and serializer can be overridden by a given but be careful,
70 82
    * by doing that all interceptors will not be executed
71 83
    */
72 -
    DistributionApi getDistributionApi() {
84 +
  DistributionApi getDistributionApi() {
73 85
    return DistributionApi(dio, serializers);
74 -
    }
75 -
86 +
  }
76 87
77 -
    /**
88 +
  /**
78 89
    * Get EvaluationApi instance, base route and serializer can be overridden by a given but be careful,
79 90
    * by doing that all interceptors will not be executed
80 91
    */
81 -
    EvaluationApi getEvaluationApi() {
92 +
  EvaluationApi getEvaluationApi() {
82 93
    return EvaluationApi(dio, serializers);
83 -
    }
94 +
  }
84 95
85 -
86 -
    /**
96 +
  /**
87 97
    * Get ExportApi instance, base route and serializer can be overridden by a given but be careful,
88 98
    * by doing that all interceptors will not be executed
89 99
    */
90 -
    ExportApi getExportApi() {
100 +
  ExportApi getExportApi() {
91 101
    return ExportApi(dio, serializers);
92 -
    }
93 -
102 +
  }
94 103
95 -
    /**
104 +
  /**
96 105
    * Get FlagApi instance, base route and serializer can be overridden by a given but be careful,
97 106
    * by doing that all interceptors will not be executed
98 107
    */
99 -
    FlagApi getFlagApi() {
108 +
  FlagApi getFlagApi() {
100 109
    return FlagApi(dio, serializers);
101 -
    }
102 -
110 +
  }
103 111
104 -
    /**
112 +
  /**
105 113
    * Get HealthApi instance, base route and serializer can be overridden by a given but be careful,
106 114
    * by doing that all interceptors will not be executed
107 115
    */
108 -
    HealthApi getHealthApi() {
116 +
  HealthApi getHealthApi() {
109 117
    return HealthApi(dio, serializers);
110 -
    }
118 +
  }
111 119
112 -
113 -
    /**
120 +
  /**
114 121
    * Get SegmentApi instance, base route and serializer can be overridden by a given but be careful,
115 122
    * by doing that all interceptors will not be executed
116 123
    */
117 -
    SegmentApi getSegmentApi() {
124 +
  SegmentApi getSegmentApi() {
118 125
    return SegmentApi(dio, serializers);
119 -
    }
120 -
126 +
  }
121 127
122 -
    /**
128 +
  /**
123 129
    * Get VariantApi instance, base route and serializer can be overridden by a given but be careful,
124 130
    * by doing that all interceptors will not be executed
125 131
    */
126 -
    VariantApi getVariantApi() {
132 +
  VariantApi getVariantApi() {
127 133
    return VariantApi(dio, serializers);
128 -
    }
129 -
130 -
134 +
  }
131 135
}
Files Coverage
lib 19.80%
Project Totals (37 files) 19.80%

No yaml found.

Create your codecov.yml to customize your Codecov experience

Sunburst
The inner-most circle is the entire project, moving away from the center are folders then, finally, a single file. The size and color of each slice is representing the number of statements and the coverage, respectively.
Icicle
The top section represents the entire project. Proceeding with folders and finally individual files. The size and color of each slice is representing the number of statements and the coverage, respectively.
Grid
Each block represents a single file in the project. The size and color of each block is represented by the number of statements and the coverage, respectively.
Loading