Line data Source code
1 : import 'package:http/http.dart'; 2 : 3 1 : enum Region { 4 1 : US, 5 1 : EU 6 : } 7 : 8 : class Stack { 9 : /// Stack API Key 10 : final String apiKey; 11 : /// Stack Delivery Token 12 : final String accessToken; 13 : /// Stack API Key 14 : final String environment; 15 : 16 : final BaseClient _client; 17 : 18 : /// The domain host to perform requests against. Defaults to `Host.delivery` i.e. `"cdn.contentstack.com"`. 19 : String host; 20 : Region _region; 21 0 : Region get region => _region; 22 0 : void set region(Region region) { 23 0 : _region = region; 24 : } 25 : 26 1 : Stack(this.apiKey, this.accessToken, this.environment, {Region region, String host, BaseClient client}) 27 : : this.host = host ?? 'api.contentstack.com', 28 : this._region = region ?? Region.US, 29 1 : this._client = client ?? Client(); 30 : 31 : 32 : }