From 7bfbeea6324e3dd34b93d3b4756df0c03bf243f4 Mon Sep 17 00:00:00 2001 From: Anikate De <40452578+Anikate-De@users.noreply.github.com> Date: Sat, 1 Jun 2024 05:05:54 +0530 Subject: [PATCH] `ok_http`: Add BaseClient Implementation and make asynchronous requests. (#1215) --- .github/workflows/okhttp.yaml | 11 + pkgs/ok_http/.gitignore | 3 + pkgs/ok_http/CHANGELOG.md | 3 +- pkgs/ok_http/analysis_options.yaml | 4 + pkgs/ok_http/android/build.gradle | 19 +- .../android/app/src/main/AndroidManifest.xml | 3 +- pkgs/ok_http/example/android/settings.gradle | 2 +- .../example/integration_test/client_test.dart | 27 + pkgs/ok_http/example/lib/book.dart | 32 + pkgs/ok_http/example/lib/main.dart | 172 +- pkgs/ok_http/example/pubspec.yaml | 86 +- pkgs/ok_http/jnigen.yaml | 80 + pkgs/ok_http/lib/ok_http.dart | 52 + pkgs/ok_http/lib/src/ok_http_client.dart | 154 ++ .../lib/src/third_party/okhttp3/Call.dart | 609 +++++ .../lib/src/third_party/okhttp3/Callback.dart | 234 ++ .../lib/src/third_party/okhttp3/Headers.dart | 1043 ++++++++ .../src/third_party/okhttp3/OkHttpClient.dart | 2112 +++++++++++++++++ .../lib/src/third_party/okhttp3/Request.dart | 1005 ++++++++ .../src/third_party/okhttp3/RequestBody.dart | 1080 +++++++++ .../lib/src/third_party/okhttp3/Response.dart | 1256 ++++++++++ .../src/third_party/okhttp3/ResponseBody.dart | 995 ++++++++ .../lib/src/third_party/okhttp3/_package.dart | 8 + pkgs/ok_http/pubspec.yaml | 3 + 24 files changed, 8853 insertions(+), 140 deletions(-) create mode 100644 pkgs/ok_http/example/integration_test/client_test.dart create mode 100644 pkgs/ok_http/example/lib/book.dart create mode 100644 pkgs/ok_http/jnigen.yaml create mode 100644 pkgs/ok_http/lib/src/ok_http_client.dart create mode 100644 pkgs/ok_http/lib/src/third_party/okhttp3/Call.dart create mode 100644 pkgs/ok_http/lib/src/third_party/okhttp3/Callback.dart create mode 100644 pkgs/ok_http/lib/src/third_party/okhttp3/Headers.dart create mode 100644 pkgs/ok_http/lib/src/third_party/okhttp3/OkHttpClient.dart create mode 100644 pkgs/ok_http/lib/src/third_party/okhttp3/Request.dart create mode 100644 pkgs/ok_http/lib/src/third_party/okhttp3/RequestBody.dart create mode 100644 pkgs/ok_http/lib/src/third_party/okhttp3/Response.dart create mode 100644 pkgs/ok_http/lib/src/third_party/okhttp3/ResponseBody.dart create mode 100644 pkgs/ok_http/lib/src/third_party/okhttp3/_package.dart diff --git a/.github/workflows/okhttp.yaml b/.github/workflows/okhttp.yaml index 9cf39b5538..6670fd2f8d 100644 --- a/.github/workflows/okhttp.yaml +++ b/.github/workflows/okhttp.yaml @@ -45,3 +45,14 @@ jobs: - name: Analyze code if: always() && steps.install.outcome == 'success' run: flutter analyze --fatal-infos + - name: Run tests + uses: reactivecircus/android-emulator-runner@6b0df4b0efb23bb0ec63d881db79aefbc976e4b2 + if: always() && steps.install.outcome == 'success' + with: + # api-level/minSdkVersion should be help in sync in: + # - .github/workflows/ok.yml + # - pkgs/ok_http/android/build.gradle + # - pkgs/ok_http/example/android/app/build.gradle + api-level: 21 + arch: x86_64 + script: cd pkgs/ok_http/example && flutter test --timeout=120s integration_test/ diff --git a/pkgs/ok_http/.gitignore b/pkgs/ok_http/.gitignore index ac5aa9893e..2e58cc573d 100644 --- a/pkgs/ok_http/.gitignore +++ b/pkgs/ok_http/.gitignore @@ -27,3 +27,6 @@ migrate_working_dir/ **/doc/api/ .dart_tool/ build/ + +# Ignore the JAR files required to generate JNI Bindings +jar/ diff --git a/pkgs/ok_http/CHANGELOG.md b/pkgs/ok_http/CHANGELOG.md index 0cbc61001a..f1c3a8b5d6 100644 --- a/pkgs/ok_http/CHANGELOG.md +++ b/pkgs/ok_http/CHANGELOG.md @@ -1,3 +1,4 @@ ## 0.1.0-wip -* Initial release. +- Implementation of [`BaseClient`](https://pub.dev/documentation/http/latest/http/BaseClient-class.html) and `send()` method using [`enqueue()` API](https://square.github.io/okhttp/5.x/okhttp/okhttp3/-call/enqueue.html) +- `ok_http` can now send asynchronous requests diff --git a/pkgs/ok_http/analysis_options.yaml b/pkgs/ok_http/analysis_options.yaml index f04c6cf0f3..0f04002ca9 100644 --- a/pkgs/ok_http/analysis_options.yaml +++ b/pkgs/ok_http/analysis_options.yaml @@ -1 +1,5 @@ include: ../../analysis_options.yaml + +analyzer: + exclude: + - lib/src/third_party/ diff --git a/pkgs/ok_http/android/build.gradle b/pkgs/ok_http/android/build.gradle index 53858758ae..c21dab37b0 100644 --- a/pkgs/ok_http/android/build.gradle +++ b/pkgs/ok_http/android/build.gradle @@ -39,21 +39,6 @@ android { // (e.g. ndkVersion "23.1.7779620") ndkVersion = android.ndkVersion - // Invoke the shared CMake build with the Android Gradle Plugin. - externalNativeBuild { - cmake { - path = "../src/CMakeLists.txt" - - // The default CMake version for the Android Gradle Plugin is 3.10.2. - // https://developer.android.com/studio/projects/install-ndk#vanilla_cmake - // - // The Flutter tooling requires that developers have CMake 3.10 or later - // installed. You should not increase this version, as doing so will cause - // the plugin to fail to compile for some customers of the plugin. - // version "3.10.2" - } - } - compileOptions { sourceCompatibility = JavaVersion.VERSION_1_8 targetCompatibility = JavaVersion.VERSION_1_8 @@ -63,3 +48,7 @@ android { minSdk = 21 } } + +dependencies { + implementation('com.squareup.okhttp3:okhttp:4.12.0') +} diff --git a/pkgs/ok_http/example/android/app/src/main/AndroidManifest.xml b/pkgs/ok_http/example/android/app/src/main/AndroidManifest.xml index 800e9dfaed..8670e67f36 100644 --- a/pkgs/ok_http/example/android/app/src/main/AndroidManifest.xml +++ b/pkgs/ok_http/example/android/app/src/main/AndroidManifest.xml @@ -2,7 +2,8 @@ + android:icon="@mipmap/ic_launcher" + android:usesCleartextTraffic="true"> testConformance() async { + group('ok_http client', () { + testRequestBody(OkHttpClient()); + testResponseBody(OkHttpClient(), canStreamResponseBody: false); + testRequestHeaders(OkHttpClient()); + testRequestMethods(OkHttpClient(), preservesMethodCase: true); + testResponseStatusLine(OkHttpClient()); + testCompressedResponseBody(OkHttpClient()); + testIsolate(OkHttpClient.new); + testResponseCookies(OkHttpClient(), canReceiveSetCookieHeaders: true); + }); +} diff --git a/pkgs/ok_http/example/lib/book.dart b/pkgs/ok_http/example/lib/book.dart new file mode 100644 index 0000000000..4954d2509b --- /dev/null +++ b/pkgs/ok_http/example/lib/book.dart @@ -0,0 +1,32 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +class Book { + String title; + String description; + Uri imageUrl; + + Book(this.title, this.description, this.imageUrl); + + static List listFromJson(Map json) { + final books = []; + + if (json['items'] case final List items) { + for (final item in items) { + if (item case {'volumeInfo': final Map volumeInfo}) { + if (volumeInfo + case { + 'title': final String title, + 'description': final String description, + 'imageLinks': {'smallThumbnail': final String thumbnail} + }) { + books.add(Book(title, description, Uri.parse(thumbnail))); + } + } + } + } + + return books; + } +} diff --git a/pkgs/ok_http/example/lib/main.dart b/pkgs/ok_http/example/lib/main.dart index 772d29afd0..0fd1807ea0 100644 --- a/pkgs/ok_http/example/lib/main.dart +++ b/pkgs/ok_http/example/lib/main.dart @@ -1,69 +1,149 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'dart:convert'; +import 'dart:io'; + import 'package:flutter/material.dart'; -import 'dart:async'; +import 'package:http/http.dart'; +import 'package:http/io_client.dart'; +import 'package:http_image_provider/http_image_provider.dart'; +import 'package:ok_http/ok_http.dart'; +import 'package:provider/provider.dart'; + +import 'book.dart'; void main() { - runApp(const MyApp()); + final Client httpClient; + if (Platform.isAndroid) { + httpClient = OkHttpClient(); + } else { + httpClient = IOClient(HttpClient()..userAgent = 'Book Agent'); + } + + runApp(Provider( + create: (_) => httpClient, + child: const BookSearchApp(), + dispose: (_, client) => client.close())); } -class MyApp extends StatefulWidget { - const MyApp({super.key}); +class BookSearchApp extends StatelessWidget { + const BookSearchApp({super.key}); @override - State createState() => _MyAppState(); + Widget build(BuildContext context) => const MaterialApp( + // Remove the debug banner. + debugShowCheckedModeBanner: false, + title: 'Book Search', + home: HomePage(), + ); } -class _MyAppState extends State { - late int sumResult; - late Future sumAsyncResult; +class HomePage extends StatefulWidget { + const HomePage({super.key}); + + @override + State createState() => _HomePageState(); +} + +class _HomePageState extends State { + List? _books; + String? _lastQuery; + late Client _client; @override void initState() { super.initState(); + _client = context.read(); + } + + // Get the list of books matching `query`. + // The `get` call will automatically use the `client` configured in `main`. + Future> _findMatchingBooks(String query) async { + final response = await _client.get( + Uri.https( + 'www.googleapis.com', + '/books/v1/volumes', + {'q': query, 'maxResults': '20', 'printType': 'books'}, + ), + ); + + final json = jsonDecode(utf8.decode(response.bodyBytes)) as Map; + return Book.listFromJson(json); + } + + void _runSearch(String query) async { + _lastQuery = query; + if (query.isEmpty) { + setState(() { + _books = null; + }); + return; + } + + final books = await _findMatchingBooks(query); + // Avoid the situation where a slow-running query finishes late and + // replaces newer search results. + if (query != _lastQuery) return; + setState(() { + _books = books; + }); } @override Widget build(BuildContext context) { - const textStyle = TextStyle(fontSize: 25); - const spacerSmall = SizedBox(height: 10); - return MaterialApp( - home: Scaffold( - appBar: AppBar( - title: const Text('Native Packages'), - ), - body: SingleChildScrollView( - child: Container( - padding: const EdgeInsets.all(10), - child: Column( - children: [ - const Text( - '', - style: textStyle, - textAlign: TextAlign.center, - ), - spacerSmall, - Text( - 'sum(1, 2) = $sumResult', - style: textStyle, - textAlign: TextAlign.center, - ), - spacerSmall, - FutureBuilder( - future: sumAsyncResult, - builder: (BuildContext context, AsyncSnapshot value) { - final displayValue = - (value.hasData) ? value.data : 'loading'; - return Text( - 'await sumAsync(3, 4) = $displayValue', - style: textStyle, - textAlign: TextAlign.center, - ); - }, - ), - ], + final searchResult = _books == null + ? const Text('Please enter a query', style: TextStyle(fontSize: 24)) + : _books!.isNotEmpty + ? BookList(_books!) + : const Text('No results found', style: TextStyle(fontSize: 24)); + + return Scaffold( + appBar: AppBar(title: const Text('Book Search')), + body: Padding( + padding: const EdgeInsets.all(10), + child: Column( + children: [ + const SizedBox(height: 20), + TextField( + onChanged: _runSearch, + decoration: const InputDecoration( + labelText: 'Search', + suffixIcon: Icon(Icons.search), + ), ), - ), + const SizedBox(height: 20), + Expanded(child: searchResult), + ], ), ), ); } } + +class BookList extends StatefulWidget { + final List books; + const BookList(this.books, {super.key}); + + @override + State createState() => _BookListState(); +} + +class _BookListState extends State { + @override + Widget build(BuildContext context) => ListView.builder( + itemCount: widget.books.length, + itemBuilder: (context, index) => Card( + key: ValueKey(widget.books[index].title), + child: ListTile( + leading: Image( + image: HttpImage( + widget.books[index].imageUrl.replace(scheme: 'https'), + client: context.read())), + title: Text(widget.books[index].title), + subtitle: Text(widget.books[index].description), + ), + ), + ); +} diff --git a/pkgs/ok_http/example/pubspec.yaml b/pkgs/ok_http/example/pubspec.yaml index 3cf6fc86a8..de52329b4b 100644 --- a/pkgs/ok_http/example/pubspec.yaml +++ b/pkgs/ok_http/example/pubspec.yaml @@ -1,97 +1,31 @@ name: ok_http_example description: "Demonstrates how to use the ok_http plugin." -# The following line prevents the package from being accidentally published to -# pub.dev using `flutter pub publish`. This is preferred for private packages. -publish_to: 'none' # Remove this line if you wish to publish to pub.dev -# The following defines the version and build number for your application. -# A version number is three numbers separated by dots, like 1.2.43 -# followed by an optional build number separated by a +. -# Both the version and the builder number may be overridden in flutter -# build by specifying --build-name and --build-number, respectively. -# In Android, build-name is used as versionName while build-number used as versionCode. -# Read more about Android versioning at https://developer.android.com/studio/publish/versioning -# In iOS, build-name is used as CFBundleShortVersionString while build-number is used as CFBundleVersion. -# Read more about iOS versioning at -# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html -# In Windows, build-name is used as the major, minor, and patch parts -# of the product and file versions while build-number is used as the build suffix. +publish_to: "none" version: 1.0.0+1 environment: - sdk: '>=3.4.1 <4.0.0' + sdk: ">=3.4.1 <4.0.0" -# Dependencies specify other packages that your package needs in order to work. -# To automatically upgrade your package dependencies to the latest versions -# consider running `flutter pub upgrade --major-versions`. Alternatively, -# dependencies can be manually updated by changing the version numbers below to -# the latest version available on pub.dev. To see which dependencies have newer -# versions available, run `flutter pub outdated`. dependencies: flutter: sdk: flutter - ok_http: - # When depending on this package from a real application you should use: - # ok_http: ^x.y.z - # See https://dart.dev/tools/pub/dependencies#version-constraints - # The example app is bundled with the plugin so we use a path dependency on - # the parent directory to use the current plugin's version. path: ../ - - # The following adds the Cupertino Icons font to your application. - # Use with the CupertinoIcons class for iOS style icons. cupertino_icons: ^1.0.6 + http: ^1.0.0 + http_image_provider: ^0.0.2 + provider: ^6.1.1 dev_dependencies: flutter_test: sdk: flutter - - # The "flutter_lints" package below contains a set of recommended lints to - # encourage good coding practices. The lint set provided by the package is - # activated in the `analysis_options.yaml` file located at the root of your - # package. See that file for information about deactivating specific lint - # rules and activating additional ones. flutter_lints: ^3.0.0 + http_client_conformance_tests: + path: ../../http_client_conformance_tests/ + integration_test: + sdk: flutter + test: ^1.23.1 -# For information on the generic Dart part of this file, see the -# following page: https://dart.dev/tools/pub/pubspec - -# The following section is specific to Flutter packages. flutter: - - # The following line ensures that the Material Icons font is - # included with your application, so that you can use the icons in - # the material Icons class. uses-material-design: true - - # To add assets to your application, add an assets section, like this: - # assets: - # - images/a_dot_burr.jpeg - # - images/a_dot_ham.jpeg - - # An image asset can refer to one or more resolution-specific "variants", see - # https://flutter.dev/assets-and-images/#resolution-aware - - # For details regarding adding assets from package dependencies, see - # https://flutter.dev/assets-and-images/#from-packages - - # To add custom fonts to your application, add a fonts section here, - # in this "flutter" section. Each entry in this list should have a - # "family" key with the font family name, and a "fonts" key with a - # list giving the asset and other descriptors for the font. For - # example: - # fonts: - # - family: Schyler - # fonts: - # - asset: fonts/Schyler-Regular.ttf - # - asset: fonts/Schyler-Italic.ttf - # style: italic - # - family: Trajan Pro - # fonts: - # - asset: fonts/TrajanPro.ttf - # - asset: fonts/TrajanPro_Bold.ttf - # weight: 700 - # - # For details regarding fonts from package dependencies, - # see https://flutter.dev/custom-fonts/#from-packages diff --git a/pkgs/ok_http/jnigen.yaml b/pkgs/ok_http/jnigen.yaml new file mode 100644 index 0000000000..b68eeb3020 --- /dev/null +++ b/pkgs/ok_http/jnigen.yaml @@ -0,0 +1,80 @@ +# To regenerate the JNI Bindings, download the OkHttp 4.12.0 JAR file from the Maven Repository +# and place them in 'jar/'. +# https://mvnrepository.com/artifact/com.squareup.okhttp3/okhttp/4.12.0 +# Then run the command: dart run jnigen --config jnigen.yaml + +summarizer: + backend: asm + +output: + dart: + path: "lib/src/third_party/" + +enable_experiment: + - "interface_implementation" + +classes: + - "okhttp3.Request" + - "okhttp3.RequestBody" + - "okhttp3.Response" + - "okhttp3.ResponseBody" + - "okhttp3.OkHttpClient" + - "okhttp3.Call" + - "okhttp3.Headers" + - "okhttp3.Callback" + +# Exclude the deprecated methods listed below +# They cause syntax errors during the `dart format` step of JNIGen. +exclude: + methods: + - "okhttp3.Request#-deprecated_url" + - "okhttp3.Request#-deprecated_method" + - "okhttp3.Request#-deprecated_headers" + - "okhttp3.Request#-deprecated_body" + - "okhttp3.Request#-deprecated_cacheControl" + - "okhttp3.Response#-deprecated_request" + - "okhttp3.Response#-deprecated_protocol" + - "okhttp3.Response#-deprecated_code" + - "okhttp3.Response#-deprecated_message" + - "okhttp3.Response#-deprecated_handshake" + - "okhttp3.Response#-deprecated_headers" + - "okhttp3.Response#-deprecated_body" + - "okhttp3.Response#-deprecated_networkResponse" + - "okhttp3.Response#-deprecated_priorResponse" + - "okhttp3.Response#-deprecated_cacheResponse" + - "okhttp3.Response#-deprecated_cacheControl" + - "okhttp3.Response#-deprecated_sentRequestAtMillis" + - "okhttp3.Response#-deprecated_receivedResponseAtMillis" + - "okhttp3.OkHttpClient#-deprecated_dispatcher" + - "okhttp3.OkHttpClient#-deprecated_connectionPool" + - "okhttp3.OkHttpClient#-deprecated_interceptors" + - "okhttp3.OkHttpClient#-deprecated_networkInterceptors" + - "okhttp3.OkHttpClient#-deprecated_eventListenerFactory" + - "okhttp3.OkHttpClient#-deprecated_retryOnConnectionFailure" + - "okhttp3.OkHttpClient#-deprecated_authenticator" + - "okhttp3.OkHttpClient#-deprecated_followRedirects" + - "okhttp3.OkHttpClient#-deprecated_followSslRedirects" + - "okhttp3.OkHttpClient#-deprecated_cookieJar" + - "okhttp3.OkHttpClient#-deprecated_cache" + - "okhttp3.OkHttpClient#-deprecated_dns" + - "okhttp3.OkHttpClient#-deprecated_proxy" + - "okhttp3.OkHttpClient#-deprecated_proxySelector" + - "okhttp3.OkHttpClient#-deprecated_proxyAuthenticator" + - "okhttp3.OkHttpClient#-deprecated_socketFactory" + - "okhttp3.OkHttpClient#-deprecated_sslSocketFactory" + - "okhttp3.OkHttpClient#-deprecated_connectionSpecs" + - "okhttp3.OkHttpClient#-deprecated_hostnameVerifier" + - "okhttp3.OkHttpClient#-deprecated_certificatePinner" + - "okhttp3.OkHttpClient#-deprecated_callTimeoutMillis" + - "okhttp3.OkHttpClient#-deprecated_connectTimeoutMillis" + - "okhttp3.OkHttpClient#-deprecated_readTimeoutMillis" + - "okhttp3.OkHttpClient#-deprecated_writeTimeoutMillis" + - "okhttp3.OkHttpClient#-deprecated_pingIntervalMillis" + - "okhttp3.OkHttpClient#-deprecated_protocols" + - 'okhttp3.OkHttpClient\$Builder#-addInterceptor' + - 'okhttp3.OkHttpClient\$Builder#-addNetworkInterceptor' + - 'okhttp3.Headers\$Companion#-deprecated_of' + - "okhttp3.Headers#-deprecated_size" + +class_path: + - "jar/okhttp-4.12.0.jar" diff --git a/pkgs/ok_http/lib/ok_http.dart b/pkgs/ok_http/lib/ok_http.dart index 4b81882abc..891ec98463 100644 --- a/pkgs/ok_http/lib/ok_http.dart +++ b/pkgs/ok_http/lib/ok_http.dart @@ -1,3 +1,55 @@ // Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. + +/// An Android Flutter plugin that provides access to the +/// [OkHttp](https://square.github.io/okhttp/) HTTP client. +/// +/// ``` +/// import 'package:ok_http/ok_http.dart'; +/// +/// void main() async { +/// var client = OkHttpClient(); +/// final response = await client.get( +/// Uri.https('www.googleapis.com', '/books/v1/volumes', {'q': '{http}'})); +/// if (response.statusCode != 200) { +/// throw HttpException('bad response: ${response.statusCode}'); +/// } +/// +/// final decodedResponse = +/// jsonDecode(utf8.decode(response.bodyBytes)) as Map; +/// +/// final itemCount = decodedResponse['totalItems']; +/// print('Number of books about http: $itemCount.'); +/// for (var i = 0; i < min(itemCount, 10); ++i) { +/// print(decodedResponse['items'][i]['volumeInfo']['title']); +/// } +/// } +/// ``` +/// +/// [OkHttpClient] is an implementation of the `package:http` [Client], +/// which means that it can easily used conditionally based on the current +/// platform. +/// +/// ``` +/// void main() { +/// var clientFactory = Client.new; // Constructs the default client. +/// if (Platform.isAndroid) { +/// clientFactory = () { +/// return OkHttpClient(); +/// }; +/// } +/// runWithClient(() => runApp(const MyFlutterApp()), clientFactory); +/// } +/// ``` +/// +/// After the above setup, calling [Client] methods or any of the +/// `package:http` convenient functions (e.g. [get]) will result in +/// [OkHttpClient] being used on Android. +library; + +import 'package:http/http.dart'; + +import 'src/ok_http_client.dart'; + +export 'src/ok_http_client.dart'; diff --git a/pkgs/ok_http/lib/src/ok_http_client.dart b/pkgs/ok_http/lib/src/ok_http_client.dart new file mode 100644 index 0000000000..d3d1c8eb69 --- /dev/null +++ b/pkgs/ok_http/lib/src/ok_http_client.dart @@ -0,0 +1,154 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +/// An Android Flutter plugin that exposes the +/// [OkHttp](https://square.github.io/okhttp/) HTTP client. +/// +/// The platform interface must be initialized before using this plugin e.g. by +/// calling +/// [`WidgetsFlutterBinding.ensureInitialized`](https://api.flutter.dev/flutter/widgets/WidgetsFlutterBinding/ensureInitialized.html) +/// or +/// [`runApp`](https://api.flutter.dev/flutter/widgets/runApp.html). +library; + +import 'dart:async'; +import 'dart:typed_data'; + +import 'package:http/http.dart'; +import 'package:jni/jni.dart'; + +import 'third_party/okhttp3/_package.dart' as bindings; + +/// An HTTP [Client] utilizing the [OkHttp](https://square.github.io/okhttp/) client. +/// +/// Example Usage: +/// ``` +/// void main() async { +/// var client = OkHttpClient(); +/// final response = await client.get( +/// Uri.https('www.googleapis.com', '/books/v1/volumes', {'q': '{http}'})); +/// if (response.statusCode != 200) { +/// throw HttpException('bad response: ${response.statusCode}'); +/// } +/// +/// final decodedResponse = +/// jsonDecode(utf8.decode(response.bodyBytes)) as Map; +/// +/// final itemCount = decodedResponse['totalItems']; +/// print('Number of books about http: $itemCount.'); +/// for (var i = 0; i < min(itemCount, 10); ++i) { +/// print(decodedResponse['items'][i]['volumeInfo']['title']); +/// } +/// } +/// ``` +class OkHttpClient extends BaseClient { + late bindings.OkHttpClient _client; + + OkHttpClient() { + _client = bindings.OkHttpClient.new1(); + } + + @override + Future send(BaseRequest request) async { + var requestUrl = request.url.toString(); + var requestHeaders = request.headers; + var requestMethod = request.method; + var requestBody = await request.finalize().toBytes(); + + final responseCompleter = Completer(); + + var reqBuilder = bindings.Request_Builder().url1(requestUrl.toJString()); + + requestHeaders.forEach((headerName, headerValue) { + reqBuilder.addHeader(headerName.toJString(), headerValue.toJString()); + }); + + // OkHttp doesn't allow a non-null RequestBody for GET and HEAD requests. + // So, we need to handle this case separately. + bindings.RequestBody okReqBody; + if (requestMethod != 'GET' && requestMethod != 'HEAD') { + okReqBody = bindings.RequestBody.create10(requestBody.toJArray()); + } else { + okReqBody = bindings.RequestBody.fromReference(jNullReference); + } + + reqBuilder.method( + requestMethod.toJString(), + okReqBody, + ); + + // `enqueue()` schedules the request to be executed in the future. + // https://square.github.io/okhttp/5.x/okhttp/okhttp3/-call/enqueue.html + _client + .newCall(reqBuilder.build()) + .enqueue(bindings.Callback.implement(bindings.$CallbackImpl( + onResponse: (bindings.Call call, bindings.Response response) { + var responseHeaders = {}; + + response.headers().toMultimap().forEach((key, value) { + responseHeaders[key.toDartString(releaseOriginal: true)] = + value.join(','); + }); + + int? contentLength; + if (responseHeaders.containsKey('content-length')) { + contentLength = int.tryParse(responseHeaders['content-length']!); + + // To be conformant with RFC 2616 14.13, we need to check if the + // content-length is a non-negative integer. + if (contentLength == null || contentLength < 0) { + responseCompleter.completeError(ClientException( + 'Invalid content-length header', request.url)); + return; + } + } + + // Exceptions while reading the response body such as + // `java.net.ProtocolException` & `java.net.SocketTimeoutException` + // crash the app if un-handled. + var responseBody = Uint8List.fromList([]); + try { + // Blocking call to read the response body. + responseBody = response.body().bytes().toUint8List(); + } catch (e) { + responseCompleter + .completeError(ClientException(e.toString(), request.url)); + return; + } + + responseCompleter.complete(StreamedResponse( + Stream.value(responseBody), + response.code(), + reasonPhrase: + response.message().toDartString(releaseOriginal: true), + headers: responseHeaders, + request: request, + contentLength: contentLength, + )); + }, + onFailure: (bindings.Call call, JObject ioException) { + responseCompleter.completeError( + ClientException(ioException.toString(), request.url)); + }, + ))); + + return responseCompleter.future; + } +} + +extension on Uint8List { + JArray toJArray() => + JArray(jbyte.type, length)..setRange(0, length, this); +} + +extension on JArray { + Uint8List toUint8List({int? length}) { + length ??= this.length; + final list = Uint8List(length); + for (var i = 0; i < length; i++) { + list[i] = this[i]; + } + return list; + } +} diff --git a/pkgs/ok_http/lib/src/third_party/okhttp3/Call.dart b/pkgs/ok_http/lib/src/third_party/okhttp3/Call.dart new file mode 100644 index 0000000000..68c52c2a83 --- /dev/null +++ b/pkgs/ok_http/lib/src/third_party/okhttp3/Call.dart @@ -0,0 +1,609 @@ +// Autogenerated by jnigen. DO NOT EDIT! + +// ignore_for_file: annotate_overrides +// ignore_for_file: camel_case_extensions +// ignore_for_file: camel_case_types +// ignore_for_file: constant_identifier_names +// ignore_for_file: doc_directive_unknown +// ignore_for_file: file_names +// ignore_for_file: lines_longer_than_80_chars +// ignore_for_file: no_leading_underscores_for_local_identifiers +// ignore_for_file: non_constant_identifier_names +// ignore_for_file: overridden_fields +// ignore_for_file: unnecessary_cast +// ignore_for_file: unused_element +// ignore_for_file: unused_field +// ignore_for_file: unused_import +// ignore_for_file: unused_local_variable +// ignore_for_file: unused_shown_name +// ignore_for_file: use_super_parameters + +import "dart:isolate" show ReceivePort; +import "dart:ffi" as ffi; +import "package:jni/internal_helpers_for_jnigen.dart"; +import "package:jni/jni.dart" as jni; + +import "Request.dart" as request_; + +import "Response.dart" as response_; + +import "Callback.dart" as callback_; + +/// from: okhttp3.Call$Factory +class Call_Factory extends jni.JObject { + @override + late final jni.JObjType $type = type; + + Call_Factory.fromReference( + jni.JReference reference, + ) : super.fromReference(reference); + + static final _class = jni.JClass.forName(r"okhttp3/Call$Factory"); + + /// The type which includes information such as the signature of this class. + static const type = $Call_FactoryType(); + static final _id_newCall = _class.instanceMethodId( + r"newCall", + r"(Lokhttp3/Request;)Lokhttp3/Call;", + ); + + static final _newCall = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + ffi.VarArgs<(ffi.Pointer,)>)>>( + "globalEnv_CallObjectMethod") + .asFunction< + jni.JniResult Function(ffi.Pointer, jni.JMethodIDPtr, + ffi.Pointer)>(); + + /// from: public abstract okhttp3.Call newCall(okhttp3.Request request) + /// The returned object must be released after use, by calling the [release] method. + Call newCall( + request_.Request request, + ) { + return _newCall(reference.pointer, _id_newCall as jni.JMethodIDPtr, + request.reference.pointer) + .object(const $CallType()); + } + + /// Maps a specific port to the implemented interface. + static final Map _$impls = {}; + ReceivePort? _$p; + + static jni.JObjectPtr _$invoke( + int port, + jni.JObjectPtr descriptor, + jni.JObjectPtr args, + ) { + return _$invokeMethod( + port, + $MethodInvocation.fromAddresses( + 0, + descriptor.address, + args.address, + ), + ); + } + + static final ffi.Pointer< + ffi.NativeFunction< + jni.JObjectPtr Function( + ffi.Uint64, jni.JObjectPtr, jni.JObjectPtr)>> + _$invokePointer = ffi.Pointer.fromFunction(_$invoke); + + static ffi.Pointer _$invokeMethod( + int $p, + $MethodInvocation $i, + ) { + try { + final $d = $i.methodDescriptor.toDartString(releaseOriginal: true); + final $a = $i.args; + if ($d == r"newCall(Lokhttp3/Request;)Lokhttp3/Call;") { + final $r = _$impls[$p]!.newCall( + $a[0].castTo(const request_.$RequestType(), releaseOriginal: true), + ); + return ($r as jni.JObject) + .castTo(const jni.JObjectType()) + .reference + .toPointer(); + } + } catch (e) { + return ProtectedJniExtensions.newDartException(e.toString()); + } + return jni.nullptr; + } + + factory Call_Factory.implement( + $Call_FactoryImpl $impl, + ) { + final $p = ReceivePort(); + final $x = Call_Factory.fromReference( + ProtectedJniExtensions.newPortProxy( + r"okhttp3.Call$Factory", + $p, + _$invokePointer, + ), + ).._$p = $p; + final $a = $p.sendPort.nativePort; + _$impls[$a] = $impl; + $p.listen(($m) { + if ($m == null) { + _$impls.remove($p.sendPort.nativePort); + $p.close(); + return; + } + final $i = $MethodInvocation.fromMessage($m as List); + final $r = _$invokeMethod($p.sendPort.nativePort, $i); + ProtectedJniExtensions.returnResult($i.result, $r); + }); + return $x; + } +} + +abstract interface class $Call_FactoryImpl { + factory $Call_FactoryImpl({ + required Call Function(request_.Request request) newCall, + }) = _$Call_FactoryImpl; + + Call newCall(request_.Request request); +} + +class _$Call_FactoryImpl implements $Call_FactoryImpl { + _$Call_FactoryImpl({ + required Call Function(request_.Request request) newCall, + }) : _newCall = newCall; + + final Call Function(request_.Request request) _newCall; + + Call newCall(request_.Request request) { + return _newCall(request); + } +} + +final class $Call_FactoryType extends jni.JObjType { + const $Call_FactoryType(); + + @override + String get signature => r"Lokhttp3/Call$Factory;"; + + @override + Call_Factory fromReference(jni.JReference reference) => + Call_Factory.fromReference(reference); + + @override + jni.JObjType get superType => const jni.JObjectType(); + + @override + final superCount = 1; + + @override + int get hashCode => ($Call_FactoryType).hashCode; + + @override + bool operator ==(Object other) { + return other.runtimeType == ($Call_FactoryType) && + other is $Call_FactoryType; + } +} + +/// from: okhttp3.Call +class Call extends jni.JObject { + @override + late final jni.JObjType $type = type; + + Call.fromReference( + jni.JReference reference, + ) : super.fromReference(reference); + + static final _class = jni.JClass.forName(r"okhttp3/Call"); + + /// The type which includes information such as the signature of this class. + static const type = $CallType(); + static final _id_request = _class.instanceMethodId( + r"request", + r"()Lokhttp3/Request;", + ); + + static final _request = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + )>>("globalEnv_CallObjectMethod") + .asFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + )>(); + + /// from: public abstract okhttp3.Request request() + /// The returned object must be released after use, by calling the [release] method. + request_.Request request() { + return _request(reference.pointer, _id_request as jni.JMethodIDPtr) + .object(const request_.$RequestType()); + } + + static final _id_execute = _class.instanceMethodId( + r"execute", + r"()Lokhttp3/Response;", + ); + + static final _execute = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + )>>("globalEnv_CallObjectMethod") + .asFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + )>(); + + /// from: public abstract okhttp3.Response execute() + /// The returned object must be released after use, by calling the [release] method. + response_.Response execute() { + return _execute(reference.pointer, _id_execute as jni.JMethodIDPtr) + .object(const response_.$ResponseType()); + } + + static final _id_enqueue = _class.instanceMethodId( + r"enqueue", + r"(Lokhttp3/Callback;)V", + ); + + static final _enqueue = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JThrowablePtr Function( + ffi.Pointer, + jni.JMethodIDPtr, + ffi.VarArgs<(ffi.Pointer,)>)>>( + "globalEnv_CallVoidMethod") + .asFunction< + jni.JThrowablePtr Function(ffi.Pointer, jni.JMethodIDPtr, + ffi.Pointer)>(); + + /// from: public abstract void enqueue(okhttp3.Callback callback) + void enqueue( + callback_.Callback callback, + ) { + _enqueue(reference.pointer, _id_enqueue as jni.JMethodIDPtr, + callback.reference.pointer) + .check(); + } + + static final _id_cancel = _class.instanceMethodId( + r"cancel", + r"()V", + ); + + static final _cancel = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JThrowablePtr Function( + ffi.Pointer, + jni.JMethodIDPtr, + )>>("globalEnv_CallVoidMethod") + .asFunction< + jni.JThrowablePtr Function( + ffi.Pointer, + jni.JMethodIDPtr, + )>(); + + /// from: public abstract void cancel() + void cancel() { + _cancel(reference.pointer, _id_cancel as jni.JMethodIDPtr).check(); + } + + static final _id_isExecuted = _class.instanceMethodId( + r"isExecuted", + r"()Z", + ); + + static final _isExecuted = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + )>>("globalEnv_CallBooleanMethod") + .asFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + )>(); + + /// from: public abstract boolean isExecuted() + bool isExecuted() { + return _isExecuted(reference.pointer, _id_isExecuted as jni.JMethodIDPtr) + .boolean; + } + + static final _id_isCanceled = _class.instanceMethodId( + r"isCanceled", + r"()Z", + ); + + static final _isCanceled = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + )>>("globalEnv_CallBooleanMethod") + .asFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + )>(); + + /// from: public abstract boolean isCanceled() + bool isCanceled() { + return _isCanceled(reference.pointer, _id_isCanceled as jni.JMethodIDPtr) + .boolean; + } + + static final _id_timeout = _class.instanceMethodId( + r"timeout", + r"()Lokio/Timeout;", + ); + + static final _timeout = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + )>>("globalEnv_CallObjectMethod") + .asFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + )>(); + + /// from: public abstract okio.Timeout timeout() + /// The returned object must be released after use, by calling the [release] method. + jni.JObject timeout() { + return _timeout(reference.pointer, _id_timeout as jni.JMethodIDPtr) + .object(const jni.JObjectType()); + } + + static final _id_clone = _class.instanceMethodId( + r"clone", + r"()Lokhttp3/Call;", + ); + + static final _clone = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + )>>("globalEnv_CallObjectMethod") + .asFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + )>(); + + /// from: public abstract okhttp3.Call clone() + /// The returned object must be released after use, by calling the [release] method. + Call clone() { + return _clone(reference.pointer, _id_clone as jni.JMethodIDPtr) + .object(const $CallType()); + } + + /// Maps a specific port to the implemented interface. + static final Map _$impls = {}; + ReceivePort? _$p; + + static jni.JObjectPtr _$invoke( + int port, + jni.JObjectPtr descriptor, + jni.JObjectPtr args, + ) { + return _$invokeMethod( + port, + $MethodInvocation.fromAddresses( + 0, + descriptor.address, + args.address, + ), + ); + } + + static final ffi.Pointer< + ffi.NativeFunction< + jni.JObjectPtr Function( + ffi.Uint64, jni.JObjectPtr, jni.JObjectPtr)>> + _$invokePointer = ffi.Pointer.fromFunction(_$invoke); + + static ffi.Pointer _$invokeMethod( + int $p, + $MethodInvocation $i, + ) { + try { + final $d = $i.methodDescriptor.toDartString(releaseOriginal: true); + final $a = $i.args; + if ($d == r"request()Lokhttp3/Request;") { + final $r = _$impls[$p]!.request(); + return ($r as jni.JObject) + .castTo(const jni.JObjectType()) + .reference + .toPointer(); + } + if ($d == r"execute()Lokhttp3/Response;") { + final $r = _$impls[$p]!.execute(); + return ($r as jni.JObject) + .castTo(const jni.JObjectType()) + .reference + .toPointer(); + } + if ($d == r"enqueue(Lokhttp3/Callback;)V") { + _$impls[$p]!.enqueue( + $a[0].castTo(const callback_.$CallbackType(), releaseOriginal: true), + ); + return jni.nullptr; + } + if ($d == r"cancel()V") { + _$impls[$p]!.cancel(); + return jni.nullptr; + } + if ($d == r"isExecuted()Z") { + final $r = _$impls[$p]!.isExecuted(); + return jni.JBoolean($r).reference.toPointer(); + } + if ($d == r"isCanceled()Z") { + final $r = _$impls[$p]!.isCanceled(); + return jni.JBoolean($r).reference.toPointer(); + } + if ($d == r"timeout()Lokio/Timeout;") { + final $r = _$impls[$p]!.timeout(); + return ($r as jni.JObject) + .castTo(const jni.JObjectType()) + .reference + .toPointer(); + } + if ($d == r"clone()Lokhttp3/Call;") { + final $r = _$impls[$p]!.clone(); + return ($r as jni.JObject) + .castTo(const jni.JObjectType()) + .reference + .toPointer(); + } + } catch (e) { + return ProtectedJniExtensions.newDartException(e.toString()); + } + return jni.nullptr; + } + + factory Call.implement( + $CallImpl $impl, + ) { + final $p = ReceivePort(); + final $x = Call.fromReference( + ProtectedJniExtensions.newPortProxy( + r"okhttp3.Call", + $p, + _$invokePointer, + ), + ).._$p = $p; + final $a = $p.sendPort.nativePort; + _$impls[$a] = $impl; + $p.listen(($m) { + if ($m == null) { + _$impls.remove($p.sendPort.nativePort); + $p.close(); + return; + } + final $i = $MethodInvocation.fromMessage($m as List); + final $r = _$invokeMethod($p.sendPort.nativePort, $i); + ProtectedJniExtensions.returnResult($i.result, $r); + }); + return $x; + } +} + +abstract interface class $CallImpl { + factory $CallImpl({ + required request_.Request Function() request, + required response_.Response Function() execute, + required void Function(callback_.Callback callback) enqueue, + required void Function() cancel, + required bool Function() isExecuted, + required bool Function() isCanceled, + required jni.JObject Function() timeout, + required Call Function() clone, + }) = _$CallImpl; + + request_.Request request(); + response_.Response execute(); + void enqueue(callback_.Callback callback); + void cancel(); + bool isExecuted(); + bool isCanceled(); + jni.JObject timeout(); + Call clone(); +} + +class _$CallImpl implements $CallImpl { + _$CallImpl({ + required request_.Request Function() request, + required response_.Response Function() execute, + required void Function(callback_.Callback callback) enqueue, + required void Function() cancel, + required bool Function() isExecuted, + required bool Function() isCanceled, + required jni.JObject Function() timeout, + required Call Function() clone, + }) : _request = request, + _execute = execute, + _enqueue = enqueue, + _cancel = cancel, + _isExecuted = isExecuted, + _isCanceled = isCanceled, + _timeout = timeout, + _clone = clone; + + final request_.Request Function() _request; + final response_.Response Function() _execute; + final void Function(callback_.Callback callback) _enqueue; + final void Function() _cancel; + final bool Function() _isExecuted; + final bool Function() _isCanceled; + final jni.JObject Function() _timeout; + final Call Function() _clone; + + request_.Request request() { + return _request(); + } + + response_.Response execute() { + return _execute(); + } + + void enqueue(callback_.Callback callback) { + return _enqueue(callback); + } + + void cancel() { + return _cancel(); + } + + bool isExecuted() { + return _isExecuted(); + } + + bool isCanceled() { + return _isCanceled(); + } + + jni.JObject timeout() { + return _timeout(); + } + + Call clone() { + return _clone(); + } +} + +final class $CallType extends jni.JObjType { + const $CallType(); + + @override + String get signature => r"Lokhttp3/Call;"; + + @override + Call fromReference(jni.JReference reference) => Call.fromReference(reference); + + @override + jni.JObjType get superType => const jni.JObjectType(); + + @override + final superCount = 1; + + @override + int get hashCode => ($CallType).hashCode; + + @override + bool operator ==(Object other) { + return other.runtimeType == ($CallType) && other is $CallType; + } +} diff --git a/pkgs/ok_http/lib/src/third_party/okhttp3/Callback.dart b/pkgs/ok_http/lib/src/third_party/okhttp3/Callback.dart new file mode 100644 index 0000000000..141720e578 --- /dev/null +++ b/pkgs/ok_http/lib/src/third_party/okhttp3/Callback.dart @@ -0,0 +1,234 @@ +// Autogenerated by jnigen. DO NOT EDIT! + +// ignore_for_file: annotate_overrides +// ignore_for_file: camel_case_extensions +// ignore_for_file: camel_case_types +// ignore_for_file: constant_identifier_names +// ignore_for_file: doc_directive_unknown +// ignore_for_file: file_names +// ignore_for_file: lines_longer_than_80_chars +// ignore_for_file: no_leading_underscores_for_local_identifiers +// ignore_for_file: non_constant_identifier_names +// ignore_for_file: overridden_fields +// ignore_for_file: unnecessary_cast +// ignore_for_file: unused_element +// ignore_for_file: unused_field +// ignore_for_file: unused_import +// ignore_for_file: unused_local_variable +// ignore_for_file: unused_shown_name +// ignore_for_file: use_super_parameters + +import "dart:isolate" show ReceivePort; +import "dart:ffi" as ffi; +import "package:jni/internal_helpers_for_jnigen.dart"; +import "package:jni/jni.dart" as jni; + +import "Call.dart" as call_; + +import "Response.dart" as response_; + +/// from: okhttp3.Callback +class Callback extends jni.JObject { + @override + late final jni.JObjType $type = type; + + Callback.fromReference( + jni.JReference reference, + ) : super.fromReference(reference); + + static final _class = jni.JClass.forName(r"okhttp3/Callback"); + + /// The type which includes information such as the signature of this class. + static const type = $CallbackType(); + static final _id_onFailure = _class.instanceMethodId( + r"onFailure", + r"(Lokhttp3/Call;Ljava/io/IOException;)V", + ); + + static final _onFailure = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JThrowablePtr Function( + ffi.Pointer, + jni.JMethodIDPtr, + ffi.VarArgs< + ( + ffi.Pointer, + ffi.Pointer + )>)>>("globalEnv_CallVoidMethod") + .asFunction< + jni.JThrowablePtr Function(ffi.Pointer, jni.JMethodIDPtr, + ffi.Pointer, ffi.Pointer)>(); + + /// from: public abstract void onFailure(okhttp3.Call call, java.io.IOException iOException) + void onFailure( + call_.Call call, + jni.JObject iOException, + ) { + _onFailure(reference.pointer, _id_onFailure as jni.JMethodIDPtr, + call.reference.pointer, iOException.reference.pointer) + .check(); + } + + static final _id_onResponse = _class.instanceMethodId( + r"onResponse", + r"(Lokhttp3/Call;Lokhttp3/Response;)V", + ); + + static final _onResponse = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JThrowablePtr Function( + ffi.Pointer, + jni.JMethodIDPtr, + ffi.VarArgs< + ( + ffi.Pointer, + ffi.Pointer + )>)>>("globalEnv_CallVoidMethod") + .asFunction< + jni.JThrowablePtr Function(ffi.Pointer, jni.JMethodIDPtr, + ffi.Pointer, ffi.Pointer)>(); + + /// from: public abstract void onResponse(okhttp3.Call call, okhttp3.Response response) + void onResponse( + call_.Call call, + response_.Response response, + ) { + _onResponse(reference.pointer, _id_onResponse as jni.JMethodIDPtr, + call.reference.pointer, response.reference.pointer) + .check(); + } + + /// Maps a specific port to the implemented interface. + static final Map _$impls = {}; + ReceivePort? _$p; + + static jni.JObjectPtr _$invoke( + int port, + jni.JObjectPtr descriptor, + jni.JObjectPtr args, + ) { + return _$invokeMethod( + port, + $MethodInvocation.fromAddresses( + 0, + descriptor.address, + args.address, + ), + ); + } + + static final ffi.Pointer< + ffi.NativeFunction< + jni.JObjectPtr Function( + ffi.Uint64, jni.JObjectPtr, jni.JObjectPtr)>> + _$invokePointer = ffi.Pointer.fromFunction(_$invoke); + + static ffi.Pointer _$invokeMethod( + int $p, + $MethodInvocation $i, + ) { + try { + final $d = $i.methodDescriptor.toDartString(releaseOriginal: true); + final $a = $i.args; + if ($d == r"onFailure(Lokhttp3/Call;Ljava/io/IOException;)V") { + _$impls[$p]!.onFailure( + $a[0].castTo(const call_.$CallType(), releaseOriginal: true), + $a[1].castTo(const jni.JObjectType(), releaseOriginal: true), + ); + return jni.nullptr; + } + if ($d == r"onResponse(Lokhttp3/Call;Lokhttp3/Response;)V") { + _$impls[$p]!.onResponse( + $a[0].castTo(const call_.$CallType(), releaseOriginal: true), + $a[1].castTo(const response_.$ResponseType(), releaseOriginal: true), + ); + return jni.nullptr; + } + } catch (e) { + return ProtectedJniExtensions.newDartException(e.toString()); + } + return jni.nullptr; + } + + factory Callback.implement( + $CallbackImpl $impl, + ) { + final $p = ReceivePort(); + final $x = Callback.fromReference( + ProtectedJniExtensions.newPortProxy( + r"okhttp3.Callback", + $p, + _$invokePointer, + ), + ).._$p = $p; + final $a = $p.sendPort.nativePort; + _$impls[$a] = $impl; + $p.listen(($m) { + if ($m == null) { + _$impls.remove($p.sendPort.nativePort); + $p.close(); + return; + } + final $i = $MethodInvocation.fromMessage($m as List); + final $r = _$invokeMethod($p.sendPort.nativePort, $i); + ProtectedJniExtensions.returnResult($i.result, $r); + }); + return $x; + } +} + +abstract interface class $CallbackImpl { + factory $CallbackImpl({ + required void Function(call_.Call call, jni.JObject iOException) onFailure, + required void Function(call_.Call call, response_.Response response) + onResponse, + }) = _$CallbackImpl; + + void onFailure(call_.Call call, jni.JObject iOException); + void onResponse(call_.Call call, response_.Response response); +} + +class _$CallbackImpl implements $CallbackImpl { + _$CallbackImpl({ + required void Function(call_.Call call, jni.JObject iOException) onFailure, + required void Function(call_.Call call, response_.Response response) + onResponse, + }) : _onFailure = onFailure, + _onResponse = onResponse; + + final void Function(call_.Call call, jni.JObject iOException) _onFailure; + final void Function(call_.Call call, response_.Response response) _onResponse; + + void onFailure(call_.Call call, jni.JObject iOException) { + return _onFailure(call, iOException); + } + + void onResponse(call_.Call call, response_.Response response) { + return _onResponse(call, response); + } +} + +final class $CallbackType extends jni.JObjType { + const $CallbackType(); + + @override + String get signature => r"Lokhttp3/Callback;"; + + @override + Callback fromReference(jni.JReference reference) => + Callback.fromReference(reference); + + @override + jni.JObjType get superType => const jni.JObjectType(); + + @override + final superCount = 1; + + @override + int get hashCode => ($CallbackType).hashCode; + + @override + bool operator ==(Object other) { + return other.runtimeType == ($CallbackType) && other is $CallbackType; + } +} diff --git a/pkgs/ok_http/lib/src/third_party/okhttp3/Headers.dart b/pkgs/ok_http/lib/src/third_party/okhttp3/Headers.dart new file mode 100644 index 0000000000..620b00b576 --- /dev/null +++ b/pkgs/ok_http/lib/src/third_party/okhttp3/Headers.dart @@ -0,0 +1,1043 @@ +// Autogenerated by jnigen. DO NOT EDIT! + +// ignore_for_file: annotate_overrides +// ignore_for_file: camel_case_extensions +// ignore_for_file: camel_case_types +// ignore_for_file: constant_identifier_names +// ignore_for_file: doc_directive_unknown +// ignore_for_file: file_names +// ignore_for_file: lines_longer_than_80_chars +// ignore_for_file: no_leading_underscores_for_local_identifiers +// ignore_for_file: non_constant_identifier_names +// ignore_for_file: overridden_fields +// ignore_for_file: unnecessary_cast +// ignore_for_file: unused_element +// ignore_for_file: unused_field +// ignore_for_file: unused_import +// ignore_for_file: unused_local_variable +// ignore_for_file: unused_shown_name +// ignore_for_file: use_super_parameters + +import "dart:isolate" show ReceivePort; +import "dart:ffi" as ffi; +import "package:jni/internal_helpers_for_jnigen.dart"; +import "package:jni/jni.dart" as jni; + +/// from: okhttp3.Headers$Builder +class Headers_Builder extends jni.JObject { + @override + late final jni.JObjType $type = type; + + Headers_Builder.fromReference( + jni.JReference reference, + ) : super.fromReference(reference); + + static final _class = jni.JClass.forName(r"okhttp3/Headers$Builder"); + + /// The type which includes information such as the signature of this class. + static const type = $Headers_BuilderType(); + static final _id_new0 = _class.constructorId( + r"()V", + ); + + static final _new0 = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + )>>("globalEnv_NewObject") + .asFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + )>(); + + /// from: public void () + /// The returned object must be released after use, by calling the [release] method. + factory Headers_Builder() { + return Headers_Builder.fromReference( + _new0(_class.reference.pointer, _id_new0 as jni.JMethodIDPtr) + .reference); + } + + static final _id_add = _class.instanceMethodId( + r"add", + r"(Ljava/lang/String;)Lokhttp3/Headers$Builder;", + ); + + static final _add = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + ffi.VarArgs<(ffi.Pointer,)>)>>( + "globalEnv_CallObjectMethod") + .asFunction< + jni.JniResult Function(ffi.Pointer, jni.JMethodIDPtr, + ffi.Pointer)>(); + + /// from: public final okhttp3.Headers$Builder add(java.lang.String string) + /// The returned object must be released after use, by calling the [release] method. + Headers_Builder add( + jni.JString string, + ) { + return _add(reference.pointer, _id_add as jni.JMethodIDPtr, + string.reference.pointer) + .object(const $Headers_BuilderType()); + } + + static final _id_add1 = _class.instanceMethodId( + r"add", + r"(Ljava/lang/String;Ljava/lang/String;)Lokhttp3/Headers$Builder;", + ); + + static final _add1 = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + ffi.VarArgs< + ( + ffi.Pointer, + ffi.Pointer + )>)>>("globalEnv_CallObjectMethod") + .asFunction< + jni.JniResult Function(ffi.Pointer, jni.JMethodIDPtr, + ffi.Pointer, ffi.Pointer)>(); + + /// from: public final okhttp3.Headers$Builder add(java.lang.String string, java.lang.String string1) + /// The returned object must be released after use, by calling the [release] method. + Headers_Builder add1( + jni.JString string, + jni.JString string1, + ) { + return _add1(reference.pointer, _id_add1 as jni.JMethodIDPtr, + string.reference.pointer, string1.reference.pointer) + .object(const $Headers_BuilderType()); + } + + static final _id_addUnsafeNonAscii = _class.instanceMethodId( + r"addUnsafeNonAscii", + r"(Ljava/lang/String;Ljava/lang/String;)Lokhttp3/Headers$Builder;", + ); + + static final _addUnsafeNonAscii = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + ffi.VarArgs< + ( + ffi.Pointer, + ffi.Pointer + )>)>>("globalEnv_CallObjectMethod") + .asFunction< + jni.JniResult Function(ffi.Pointer, jni.JMethodIDPtr, + ffi.Pointer, ffi.Pointer)>(); + + /// from: public final okhttp3.Headers$Builder addUnsafeNonAscii(java.lang.String string, java.lang.String string1) + /// The returned object must be released after use, by calling the [release] method. + Headers_Builder addUnsafeNonAscii( + jni.JString string, + jni.JString string1, + ) { + return _addUnsafeNonAscii( + reference.pointer, + _id_addUnsafeNonAscii as jni.JMethodIDPtr, + string.reference.pointer, + string1.reference.pointer) + .object(const $Headers_BuilderType()); + } + + static final _id_addAll = _class.instanceMethodId( + r"addAll", + r"(Lokhttp3/Headers;)Lokhttp3/Headers$Builder;", + ); + + static final _addAll = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + ffi.VarArgs<(ffi.Pointer,)>)>>( + "globalEnv_CallObjectMethod") + .asFunction< + jni.JniResult Function(ffi.Pointer, jni.JMethodIDPtr, + ffi.Pointer)>(); + + /// from: public final okhttp3.Headers$Builder addAll(okhttp3.Headers headers) + /// The returned object must be released after use, by calling the [release] method. + Headers_Builder addAll( + Headers headers, + ) { + return _addAll(reference.pointer, _id_addAll as jni.JMethodIDPtr, + headers.reference.pointer) + .object(const $Headers_BuilderType()); + } + + static final _id_add2 = _class.instanceMethodId( + r"add", + r"(Ljava/lang/String;Ljava/util/Date;)Lokhttp3/Headers$Builder;", + ); + + static final _add2 = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + ffi.VarArgs< + ( + ffi.Pointer, + ffi.Pointer + )>)>>("globalEnv_CallObjectMethod") + .asFunction< + jni.JniResult Function(ffi.Pointer, jni.JMethodIDPtr, + ffi.Pointer, ffi.Pointer)>(); + + /// from: public final okhttp3.Headers$Builder add(java.lang.String string, java.util.Date date) + /// The returned object must be released after use, by calling the [release] method. + Headers_Builder add2( + jni.JString string, + jni.JObject date, + ) { + return _add2(reference.pointer, _id_add2 as jni.JMethodIDPtr, + string.reference.pointer, date.reference.pointer) + .object(const $Headers_BuilderType()); + } + + static final _id_add3 = _class.instanceMethodId( + r"add", + r"(Ljava/lang/String;Ljava/time/Instant;)Lokhttp3/Headers$Builder;", + ); + + static final _add3 = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + ffi.VarArgs< + ( + ffi.Pointer, + ffi.Pointer + )>)>>("globalEnv_CallObjectMethod") + .asFunction< + jni.JniResult Function(ffi.Pointer, jni.JMethodIDPtr, + ffi.Pointer, ffi.Pointer)>(); + + /// from: public final okhttp3.Headers$Builder add(java.lang.String string, java.time.Instant instant) + /// The returned object must be released after use, by calling the [release] method. + Headers_Builder add3( + jni.JString string, + jni.JObject instant, + ) { + return _add3(reference.pointer, _id_add3 as jni.JMethodIDPtr, + string.reference.pointer, instant.reference.pointer) + .object(const $Headers_BuilderType()); + } + + static final _id_set0 = _class.instanceMethodId( + r"set", + r"(Ljava/lang/String;Ljava/util/Date;)Lokhttp3/Headers$Builder;", + ); + + static final _set0 = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + ffi.VarArgs< + ( + ffi.Pointer, + ffi.Pointer + )>)>>("globalEnv_CallObjectMethod") + .asFunction< + jni.JniResult Function(ffi.Pointer, jni.JMethodIDPtr, + ffi.Pointer, ffi.Pointer)>(); + + /// from: public final okhttp3.Headers$Builder set(java.lang.String string, java.util.Date date) + /// The returned object must be released after use, by calling the [release] method. + Headers_Builder set0( + jni.JString string, + jni.JObject date, + ) { + return _set0(reference.pointer, _id_set0 as jni.JMethodIDPtr, + string.reference.pointer, date.reference.pointer) + .object(const $Headers_BuilderType()); + } + + static final _id_set1 = _class.instanceMethodId( + r"set", + r"(Ljava/lang/String;Ljava/time/Instant;)Lokhttp3/Headers$Builder;", + ); + + static final _set1 = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + ffi.VarArgs< + ( + ffi.Pointer, + ffi.Pointer + )>)>>("globalEnv_CallObjectMethod") + .asFunction< + jni.JniResult Function(ffi.Pointer, jni.JMethodIDPtr, + ffi.Pointer, ffi.Pointer)>(); + + /// from: public final okhttp3.Headers$Builder set(java.lang.String string, java.time.Instant instant) + /// The returned object must be released after use, by calling the [release] method. + Headers_Builder set1( + jni.JString string, + jni.JObject instant, + ) { + return _set1(reference.pointer, _id_set1 as jni.JMethodIDPtr, + string.reference.pointer, instant.reference.pointer) + .object(const $Headers_BuilderType()); + } + + static final _id_removeAll = _class.instanceMethodId( + r"removeAll", + r"(Ljava/lang/String;)Lokhttp3/Headers$Builder;", + ); + + static final _removeAll = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + ffi.VarArgs<(ffi.Pointer,)>)>>( + "globalEnv_CallObjectMethod") + .asFunction< + jni.JniResult Function(ffi.Pointer, jni.JMethodIDPtr, + ffi.Pointer)>(); + + /// from: public final okhttp3.Headers$Builder removeAll(java.lang.String string) + /// The returned object must be released after use, by calling the [release] method. + Headers_Builder removeAll( + jni.JString string, + ) { + return _removeAll(reference.pointer, _id_removeAll as jni.JMethodIDPtr, + string.reference.pointer) + .object(const $Headers_BuilderType()); + } + + static final _id_set2 = _class.instanceMethodId( + r"set", + r"(Ljava/lang/String;Ljava/lang/String;)Lokhttp3/Headers$Builder;", + ); + + static final _set2 = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + ffi.VarArgs< + ( + ffi.Pointer, + ffi.Pointer + )>)>>("globalEnv_CallObjectMethod") + .asFunction< + jni.JniResult Function(ffi.Pointer, jni.JMethodIDPtr, + ffi.Pointer, ffi.Pointer)>(); + + /// from: public final okhttp3.Headers$Builder set(java.lang.String string, java.lang.String string1) + /// The returned object must be released after use, by calling the [release] method. + Headers_Builder set2( + jni.JString string, + jni.JString string1, + ) { + return _set2(reference.pointer, _id_set2 as jni.JMethodIDPtr, + string.reference.pointer, string1.reference.pointer) + .object(const $Headers_BuilderType()); + } + + static final _id_get0 = _class.instanceMethodId( + r"get", + r"(Ljava/lang/String;)Ljava/lang/String;", + ); + + static final _get0 = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + ffi.VarArgs<(ffi.Pointer,)>)>>( + "globalEnv_CallObjectMethod") + .asFunction< + jni.JniResult Function(ffi.Pointer, jni.JMethodIDPtr, + ffi.Pointer)>(); + + /// from: public final java.lang.String get(java.lang.String string) + /// The returned object must be released after use, by calling the [release] method. + jni.JString get0( + jni.JString string, + ) { + return _get0(reference.pointer, _id_get0 as jni.JMethodIDPtr, + string.reference.pointer) + .object(const jni.JStringType()); + } + + static final _id_build = _class.instanceMethodId( + r"build", + r"()Lokhttp3/Headers;", + ); + + static final _build = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + )>>("globalEnv_CallObjectMethod") + .asFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + )>(); + + /// from: public final okhttp3.Headers build() + /// The returned object must be released after use, by calling the [release] method. + Headers build() { + return _build(reference.pointer, _id_build as jni.JMethodIDPtr) + .object(const $HeadersType()); + } +} + +final class $Headers_BuilderType extends jni.JObjType { + const $Headers_BuilderType(); + + @override + String get signature => r"Lokhttp3/Headers$Builder;"; + + @override + Headers_Builder fromReference(jni.JReference reference) => + Headers_Builder.fromReference(reference); + + @override + jni.JObjType get superType => const jni.JObjectType(); + + @override + final superCount = 1; + + @override + int get hashCode => ($Headers_BuilderType).hashCode; + + @override + bool operator ==(Object other) { + return other.runtimeType == ($Headers_BuilderType) && + other is $Headers_BuilderType; + } +} + +/// from: okhttp3.Headers$Companion +class Headers_Companion extends jni.JObject { + @override + late final jni.JObjType $type = type; + + Headers_Companion.fromReference( + jni.JReference reference, + ) : super.fromReference(reference); + + static final _class = jni.JClass.forName(r"okhttp3/Headers$Companion"); + + /// The type which includes information such as the signature of this class. + static const type = $Headers_CompanionType(); + static final _id_of = _class.instanceMethodId( + r"of", + r"([Ljava/lang/String;)Lokhttp3/Headers;", + ); + + static final _of = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + ffi.VarArgs<(ffi.Pointer,)>)>>( + "globalEnv_CallObjectMethod") + .asFunction< + jni.JniResult Function(ffi.Pointer, jni.JMethodIDPtr, + ffi.Pointer)>(); + + /// from: public final okhttp3.Headers of(java.lang.String[] strings) + /// The returned object must be released after use, by calling the [release] method. + Headers of( + jni.JArray strings, + ) { + return _of(reference.pointer, _id_of as jni.JMethodIDPtr, + strings.reference.pointer) + .object(const $HeadersType()); + } + + static final _id_of1 = _class.instanceMethodId( + r"of", + r"(Ljava/util/Map;)Lokhttp3/Headers;", + ); + + static final _of1 = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + ffi.VarArgs<(ffi.Pointer,)>)>>( + "globalEnv_CallObjectMethod") + .asFunction< + jni.JniResult Function(ffi.Pointer, jni.JMethodIDPtr, + ffi.Pointer)>(); + + /// from: public final okhttp3.Headers of(java.util.Map map) + /// The returned object must be released after use, by calling the [release] method. + Headers of1( + jni.JMap map, + ) { + return _of1(reference.pointer, _id_of1 as jni.JMethodIDPtr, + map.reference.pointer) + .object(const $HeadersType()); + } + + static final _id_new0 = _class.constructorId( + r"(Lkotlin/jvm/internal/DefaultConstructorMarker;)V", + ); + + static final _new0 = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + ffi.VarArgs<(ffi.Pointer,)>)>>( + "globalEnv_NewObject") + .asFunction< + jni.JniResult Function(ffi.Pointer, jni.JMethodIDPtr, + ffi.Pointer)>(); + + /// from: public void (kotlin.jvm.internal.DefaultConstructorMarker defaultConstructorMarker) + /// The returned object must be released after use, by calling the [release] method. + factory Headers_Companion( + jni.JObject defaultConstructorMarker, + ) { + return Headers_Companion.fromReference(_new0( + _class.reference.pointer, + _id_new0 as jni.JMethodIDPtr, + defaultConstructorMarker.reference.pointer) + .reference); + } +} + +final class $Headers_CompanionType extends jni.JObjType { + const $Headers_CompanionType(); + + @override + String get signature => r"Lokhttp3/Headers$Companion;"; + + @override + Headers_Companion fromReference(jni.JReference reference) => + Headers_Companion.fromReference(reference); + + @override + jni.JObjType get superType => const jni.JObjectType(); + + @override + final superCount = 1; + + @override + int get hashCode => ($Headers_CompanionType).hashCode; + + @override + bool operator ==(Object other) { + return other.runtimeType == ($Headers_CompanionType) && + other is $Headers_CompanionType; + } +} + +/// from: okhttp3.Headers +class Headers extends jni.JObject { + @override + late final jni.JObjType $type = type; + + Headers.fromReference( + jni.JReference reference, + ) : super.fromReference(reference); + + static final _class = jni.JClass.forName(r"okhttp3/Headers"); + + /// The type which includes information such as the signature of this class. + static const type = $HeadersType(); + static final _id_Companion = _class.staticFieldId( + r"Companion", + r"Lokhttp3/Headers$Companion;", + ); + + /// from: static public final okhttp3.Headers$Companion Companion + /// The returned object must be released after use, by calling the [release] method. + static Headers_Companion get Companion => + _id_Companion.get(_class, const $Headers_CompanionType()); + + static final _id_get0 = _class.instanceMethodId( + r"get", + r"(Ljava/lang/String;)Ljava/lang/String;", + ); + + static final _get0 = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + ffi.VarArgs<(ffi.Pointer,)>)>>( + "globalEnv_CallObjectMethod") + .asFunction< + jni.JniResult Function(ffi.Pointer, jni.JMethodIDPtr, + ffi.Pointer)>(); + + /// from: public final java.lang.String get(java.lang.String string) + /// The returned object must be released after use, by calling the [release] method. + jni.JString get0( + jni.JString string, + ) { + return _get0(reference.pointer, _id_get0 as jni.JMethodIDPtr, + string.reference.pointer) + .object(const jni.JStringType()); + } + + static final _id_getDate = _class.instanceMethodId( + r"getDate", + r"(Ljava/lang/String;)Ljava/util/Date;", + ); + + static final _getDate = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + ffi.VarArgs<(ffi.Pointer,)>)>>( + "globalEnv_CallObjectMethod") + .asFunction< + jni.JniResult Function(ffi.Pointer, jni.JMethodIDPtr, + ffi.Pointer)>(); + + /// from: public final java.util.Date getDate(java.lang.String string) + /// The returned object must be released after use, by calling the [release] method. + jni.JObject getDate( + jni.JString string, + ) { + return _getDate(reference.pointer, _id_getDate as jni.JMethodIDPtr, + string.reference.pointer) + .object(const jni.JObjectType()); + } + + static final _id_getInstant = _class.instanceMethodId( + r"getInstant", + r"(Ljava/lang/String;)Ljava/time/Instant;", + ); + + static final _getInstant = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + ffi.VarArgs<(ffi.Pointer,)>)>>( + "globalEnv_CallObjectMethod") + .asFunction< + jni.JniResult Function(ffi.Pointer, jni.JMethodIDPtr, + ffi.Pointer)>(); + + /// from: public final java.time.Instant getInstant(java.lang.String string) + /// The returned object must be released after use, by calling the [release] method. + jni.JObject getInstant( + jni.JString string, + ) { + return _getInstant(reference.pointer, _id_getInstant as jni.JMethodIDPtr, + string.reference.pointer) + .object(const jni.JObjectType()); + } + + static final _id_size = _class.instanceMethodId( + r"size", + r"()I", + ); + + static final _size = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + )>>("globalEnv_CallIntMethod") + .asFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + )>(); + + /// from: public final int size() + int size() { + return _size(reference.pointer, _id_size as jni.JMethodIDPtr).integer; + } + + static final _id_name = _class.instanceMethodId( + r"name", + r"(I)Ljava/lang/String;", + ); + + static final _name = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function(ffi.Pointer, jni.JMethodIDPtr, + ffi.VarArgs<(ffi.Int64,)>)>>("globalEnv_CallObjectMethod") + .asFunction< + jni.JniResult Function( + ffi.Pointer, jni.JMethodIDPtr, int)>(); + + /// from: public final java.lang.String name(int i) + /// The returned object must be released after use, by calling the [release] method. + jni.JString name( + int i, + ) { + return _name(reference.pointer, _id_name as jni.JMethodIDPtr, i) + .object(const jni.JStringType()); + } + + static final _id_value = _class.instanceMethodId( + r"value", + r"(I)Ljava/lang/String;", + ); + + static final _value = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function(ffi.Pointer, jni.JMethodIDPtr, + ffi.VarArgs<(ffi.Int64,)>)>>("globalEnv_CallObjectMethod") + .asFunction< + jni.JniResult Function( + ffi.Pointer, jni.JMethodIDPtr, int)>(); + + /// from: public final java.lang.String value(int i) + /// The returned object must be released after use, by calling the [release] method. + jni.JString value( + int i, + ) { + return _value(reference.pointer, _id_value as jni.JMethodIDPtr, i) + .object(const jni.JStringType()); + } + + static final _id_names = _class.instanceMethodId( + r"names", + r"()Ljava/util/Set;", + ); + + static final _names = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + )>>("globalEnv_CallObjectMethod") + .asFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + )>(); + + /// from: public final java.util.Set names() + /// The returned object must be released after use, by calling the [release] method. + jni.JSet names() { + return _names(reference.pointer, _id_names as jni.JMethodIDPtr) + .object(const jni.JSetType(jni.JStringType())); + } + + static final _id_values = _class.instanceMethodId( + r"values", + r"(Ljava/lang/String;)Ljava/util/List;", + ); + + static final _values = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + ffi.VarArgs<(ffi.Pointer,)>)>>( + "globalEnv_CallObjectMethod") + .asFunction< + jni.JniResult Function(ffi.Pointer, jni.JMethodIDPtr, + ffi.Pointer)>(); + + /// from: public final java.util.List values(java.lang.String string) + /// The returned object must be released after use, by calling the [release] method. + jni.JList values( + jni.JString string, + ) { + return _values(reference.pointer, _id_values as jni.JMethodIDPtr, + string.reference.pointer) + .object(const jni.JListType(jni.JStringType())); + } + + static final _id_byteCount = _class.instanceMethodId( + r"byteCount", + r"()J", + ); + + static final _byteCount = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + )>>("globalEnv_CallLongMethod") + .asFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + )>(); + + /// from: public final long byteCount() + int byteCount() { + return _byteCount(reference.pointer, _id_byteCount as jni.JMethodIDPtr) + .long; + } + + static final _id_iterator = _class.instanceMethodId( + r"iterator", + r"()Ljava/util/Iterator;", + ); + + static final _iterator = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + )>>("globalEnv_CallObjectMethod") + .asFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + )>(); + + /// from: public java.util.Iterator iterator() + /// The returned object must be released after use, by calling the [release] method. + jni.JIterator iterator() { + return _iterator(reference.pointer, _id_iterator as jni.JMethodIDPtr) + .object(const jni.JIteratorType(jni.JObjectType())); + } + + static final _id_newBuilder = _class.instanceMethodId( + r"newBuilder", + r"()Lokhttp3/Headers$Builder;", + ); + + static final _newBuilder = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + )>>("globalEnv_CallObjectMethod") + .asFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + )>(); + + /// from: public final okhttp3.Headers$Builder newBuilder() + /// The returned object must be released after use, by calling the [release] method. + Headers_Builder newBuilder() { + return _newBuilder(reference.pointer, _id_newBuilder as jni.JMethodIDPtr) + .object(const $Headers_BuilderType()); + } + + static final _id_equals = _class.instanceMethodId( + r"equals", + r"(Ljava/lang/Object;)Z", + ); + + static final _equals = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + ffi.VarArgs<(ffi.Pointer,)>)>>( + "globalEnv_CallBooleanMethod") + .asFunction< + jni.JniResult Function(ffi.Pointer, jni.JMethodIDPtr, + ffi.Pointer)>(); + + /// from: public boolean equals(java.lang.Object object) + bool equals( + jni.JObject object, + ) { + return _equals(reference.pointer, _id_equals as jni.JMethodIDPtr, + object.reference.pointer) + .boolean; + } + + static final _id_hashCode1 = _class.instanceMethodId( + r"hashCode", + r"()I", + ); + + static final _hashCode1 = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + )>>("globalEnv_CallIntMethod") + .asFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + )>(); + + /// from: public int hashCode() + int hashCode1() { + return _hashCode1(reference.pointer, _id_hashCode1 as jni.JMethodIDPtr) + .integer; + } + + static final _id_toString1 = _class.instanceMethodId( + r"toString", + r"()Ljava/lang/String;", + ); + + static final _toString1 = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + )>>("globalEnv_CallObjectMethod") + .asFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + )>(); + + /// from: public java.lang.String toString() + /// The returned object must be released after use, by calling the [release] method. + jni.JString toString1() { + return _toString1(reference.pointer, _id_toString1 as jni.JMethodIDPtr) + .object(const jni.JStringType()); + } + + static final _id_toMultimap = _class.instanceMethodId( + r"toMultimap", + r"()Ljava/util/Map;", + ); + + static final _toMultimap = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + )>>("globalEnv_CallObjectMethod") + .asFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + )>(); + + /// from: public final java.util.Map toMultimap() + /// The returned object must be released after use, by calling the [release] method. + jni.JMap> toMultimap() { + return _toMultimap(reference.pointer, _id_toMultimap as jni.JMethodIDPtr) + .object(const jni.JMapType( + jni.JStringType(), jni.JListType(jni.JStringType()))); + } + + static final _id_of = _class.staticMethodId( + r"of", + r"([Ljava/lang/String;)Lokhttp3/Headers;", + ); + + static final _of = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + ffi.VarArgs<(ffi.Pointer,)>)>>( + "globalEnv_CallStaticObjectMethod") + .asFunction< + jni.JniResult Function(ffi.Pointer, jni.JMethodIDPtr, + ffi.Pointer)>(); + + /// from: static public final okhttp3.Headers of(java.lang.String[] strings) + /// The returned object must be released after use, by calling the [release] method. + static Headers of( + jni.JArray strings, + ) { + return _of(_class.reference.pointer, _id_of as jni.JMethodIDPtr, + strings.reference.pointer) + .object(const $HeadersType()); + } + + static final _id_of1 = _class.staticMethodId( + r"of", + r"(Ljava/util/Map;)Lokhttp3/Headers;", + ); + + static final _of1 = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + ffi.VarArgs<(ffi.Pointer,)>)>>( + "globalEnv_CallStaticObjectMethod") + .asFunction< + jni.JniResult Function(ffi.Pointer, jni.JMethodIDPtr, + ffi.Pointer)>(); + + /// from: static public final okhttp3.Headers of(java.util.Map map) + /// The returned object must be released after use, by calling the [release] method. + static Headers of1( + jni.JMap map, + ) { + return _of1(_class.reference.pointer, _id_of1 as jni.JMethodIDPtr, + map.reference.pointer) + .object(const $HeadersType()); + } + + static final _id_new0 = _class.constructorId( + r"([Ljava/lang/String;Lkotlin/jvm/internal/DefaultConstructorMarker;)V", + ); + + static final _new0 = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + ffi.VarArgs< + ( + ffi.Pointer, + ffi.Pointer + )>)>>("globalEnv_NewObject") + .asFunction< + jni.JniResult Function(ffi.Pointer, jni.JMethodIDPtr, + ffi.Pointer, ffi.Pointer)>(); + + /// from: public void (java.lang.String[] strings, kotlin.jvm.internal.DefaultConstructorMarker defaultConstructorMarker) + /// The returned object must be released after use, by calling the [release] method. + factory Headers( + jni.JArray strings, + jni.JObject defaultConstructorMarker, + ) { + return Headers.fromReference(_new0( + _class.reference.pointer, + _id_new0 as jni.JMethodIDPtr, + strings.reference.pointer, + defaultConstructorMarker.reference.pointer) + .reference); + } +} + +final class $HeadersType extends jni.JObjType { + const $HeadersType(); + + @override + String get signature => r"Lokhttp3/Headers;"; + + @override + Headers fromReference(jni.JReference reference) => + Headers.fromReference(reference); + + @override + jni.JObjType get superType => const jni.JObjectType(); + + @override + final superCount = 1; + + @override + int get hashCode => ($HeadersType).hashCode; + + @override + bool operator ==(Object other) { + return other.runtimeType == ($HeadersType) && other is $HeadersType; + } +} diff --git a/pkgs/ok_http/lib/src/third_party/okhttp3/OkHttpClient.dart b/pkgs/ok_http/lib/src/third_party/okhttp3/OkHttpClient.dart new file mode 100644 index 0000000000..1a68b3b2e0 --- /dev/null +++ b/pkgs/ok_http/lib/src/third_party/okhttp3/OkHttpClient.dart @@ -0,0 +1,2112 @@ +// Autogenerated by jnigen. DO NOT EDIT! + +// ignore_for_file: annotate_overrides +// ignore_for_file: camel_case_extensions +// ignore_for_file: camel_case_types +// ignore_for_file: constant_identifier_names +// ignore_for_file: doc_directive_unknown +// ignore_for_file: file_names +// ignore_for_file: lines_longer_than_80_chars +// ignore_for_file: no_leading_underscores_for_local_identifiers +// ignore_for_file: non_constant_identifier_names +// ignore_for_file: overridden_fields +// ignore_for_file: unnecessary_cast +// ignore_for_file: unused_element +// ignore_for_file: unused_field +// ignore_for_file: unused_import +// ignore_for_file: unused_local_variable +// ignore_for_file: unused_shown_name +// ignore_for_file: use_super_parameters + +import "dart:isolate" show ReceivePort; +import "dart:ffi" as ffi; +import "package:jni/internal_helpers_for_jnigen.dart"; +import "package:jni/jni.dart" as jni; + +import "Request.dart" as request_; + +import "Call.dart" as call_; + +/// from: okhttp3.OkHttpClient$Builder +class OkHttpClient_Builder extends jni.JObject { + @override + late final jni.JObjType $type = type; + + OkHttpClient_Builder.fromReference( + jni.JReference reference, + ) : super.fromReference(reference); + + static final _class = jni.JClass.forName(r"okhttp3/OkHttpClient$Builder"); + + /// The type which includes information such as the signature of this class. + static const type = $OkHttpClient_BuilderType(); + static final _id_new0 = _class.constructorId( + r"()V", + ); + + static final _new0 = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + )>>("globalEnv_NewObject") + .asFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + )>(); + + /// from: public void () + /// The returned object must be released after use, by calling the [release] method. + factory OkHttpClient_Builder() { + return OkHttpClient_Builder.fromReference( + _new0(_class.reference.pointer, _id_new0 as jni.JMethodIDPtr) + .reference); + } + + static final _id_new1 = _class.constructorId( + r"(Lokhttp3/OkHttpClient;)V", + ); + + static final _new1 = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + ffi.VarArgs<(ffi.Pointer,)>)>>( + "globalEnv_NewObject") + .asFunction< + jni.JniResult Function(ffi.Pointer, jni.JMethodIDPtr, + ffi.Pointer)>(); + + /// from: public void (okhttp3.OkHttpClient okHttpClient) + /// The returned object must be released after use, by calling the [release] method. + factory OkHttpClient_Builder.new1( + OkHttpClient okHttpClient, + ) { + return OkHttpClient_Builder.fromReference(_new1(_class.reference.pointer, + _id_new1 as jni.JMethodIDPtr, okHttpClient.reference.pointer) + .reference); + } + + static final _id_dispatcher = _class.instanceMethodId( + r"dispatcher", + r"(Lokhttp3/Dispatcher;)Lokhttp3/OkHttpClient$Builder;", + ); + + static final _dispatcher = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + ffi.VarArgs<(ffi.Pointer,)>)>>( + "globalEnv_CallObjectMethod") + .asFunction< + jni.JniResult Function(ffi.Pointer, jni.JMethodIDPtr, + ffi.Pointer)>(); + + /// from: public final okhttp3.OkHttpClient$Builder dispatcher(okhttp3.Dispatcher dispatcher) + /// The returned object must be released after use, by calling the [release] method. + OkHttpClient_Builder dispatcher( + jni.JObject dispatcher, + ) { + return _dispatcher(reference.pointer, _id_dispatcher as jni.JMethodIDPtr, + dispatcher.reference.pointer) + .object(const $OkHttpClient_BuilderType()); + } + + static final _id_connectionPool = _class.instanceMethodId( + r"connectionPool", + r"(Lokhttp3/ConnectionPool;)Lokhttp3/OkHttpClient$Builder;", + ); + + static final _connectionPool = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + ffi.VarArgs<(ffi.Pointer,)>)>>( + "globalEnv_CallObjectMethod") + .asFunction< + jni.JniResult Function(ffi.Pointer, jni.JMethodIDPtr, + ffi.Pointer)>(); + + /// from: public final okhttp3.OkHttpClient$Builder connectionPool(okhttp3.ConnectionPool connectionPool) + /// The returned object must be released after use, by calling the [release] method. + OkHttpClient_Builder connectionPool( + jni.JObject connectionPool, + ) { + return _connectionPool( + reference.pointer, + _id_connectionPool as jni.JMethodIDPtr, + connectionPool.reference.pointer) + .object(const $OkHttpClient_BuilderType()); + } + + static final _id_interceptors = _class.instanceMethodId( + r"interceptors", + r"()Ljava/util/List;", + ); + + static final _interceptors = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + )>>("globalEnv_CallObjectMethod") + .asFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + )>(); + + /// from: public final java.util.List interceptors() + /// The returned object must be released after use, by calling the [release] method. + jni.JList interceptors() { + return _interceptors( + reference.pointer, _id_interceptors as jni.JMethodIDPtr) + .object(const jni.JListType(jni.JObjectType())); + } + + static final _id_addInterceptor = _class.instanceMethodId( + r"addInterceptor", + r"(Lokhttp3/Interceptor;)Lokhttp3/OkHttpClient$Builder;", + ); + + static final _addInterceptor = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + ffi.VarArgs<(ffi.Pointer,)>)>>( + "globalEnv_CallObjectMethod") + .asFunction< + jni.JniResult Function(ffi.Pointer, jni.JMethodIDPtr, + ffi.Pointer)>(); + + /// from: public final okhttp3.OkHttpClient$Builder addInterceptor(okhttp3.Interceptor interceptor) + /// The returned object must be released after use, by calling the [release] method. + OkHttpClient_Builder addInterceptor( + jni.JObject interceptor, + ) { + return _addInterceptor( + reference.pointer, + _id_addInterceptor as jni.JMethodIDPtr, + interceptor.reference.pointer) + .object(const $OkHttpClient_BuilderType()); + } + + static final _id_networkInterceptors = _class.instanceMethodId( + r"networkInterceptors", + r"()Ljava/util/List;", + ); + + static final _networkInterceptors = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + )>>("globalEnv_CallObjectMethod") + .asFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + )>(); + + /// from: public final java.util.List networkInterceptors() + /// The returned object must be released after use, by calling the [release] method. + jni.JList networkInterceptors() { + return _networkInterceptors( + reference.pointer, _id_networkInterceptors as jni.JMethodIDPtr) + .object(const jni.JListType(jni.JObjectType())); + } + + static final _id_addNetworkInterceptor = _class.instanceMethodId( + r"addNetworkInterceptor", + r"(Lokhttp3/Interceptor;)Lokhttp3/OkHttpClient$Builder;", + ); + + static final _addNetworkInterceptor = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + ffi.VarArgs<(ffi.Pointer,)>)>>( + "globalEnv_CallObjectMethod") + .asFunction< + jni.JniResult Function(ffi.Pointer, jni.JMethodIDPtr, + ffi.Pointer)>(); + + /// from: public final okhttp3.OkHttpClient$Builder addNetworkInterceptor(okhttp3.Interceptor interceptor) + /// The returned object must be released after use, by calling the [release] method. + OkHttpClient_Builder addNetworkInterceptor( + jni.JObject interceptor, + ) { + return _addNetworkInterceptor( + reference.pointer, + _id_addNetworkInterceptor as jni.JMethodIDPtr, + interceptor.reference.pointer) + .object(const $OkHttpClient_BuilderType()); + } + + static final _id_eventListener = _class.instanceMethodId( + r"eventListener", + r"(Lokhttp3/EventListener;)Lokhttp3/OkHttpClient$Builder;", + ); + + static final _eventListener = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + ffi.VarArgs<(ffi.Pointer,)>)>>( + "globalEnv_CallObjectMethod") + .asFunction< + jni.JniResult Function(ffi.Pointer, jni.JMethodIDPtr, + ffi.Pointer)>(); + + /// from: public final okhttp3.OkHttpClient$Builder eventListener(okhttp3.EventListener eventListener) + /// The returned object must be released after use, by calling the [release] method. + OkHttpClient_Builder eventListener( + jni.JObject eventListener, + ) { + return _eventListener( + reference.pointer, + _id_eventListener as jni.JMethodIDPtr, + eventListener.reference.pointer) + .object(const $OkHttpClient_BuilderType()); + } + + static final _id_eventListenerFactory = _class.instanceMethodId( + r"eventListenerFactory", + r"(Lokhttp3/EventListener$Factory;)Lokhttp3/OkHttpClient$Builder;", + ); + + static final _eventListenerFactory = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + ffi.VarArgs<(ffi.Pointer,)>)>>( + "globalEnv_CallObjectMethod") + .asFunction< + jni.JniResult Function(ffi.Pointer, jni.JMethodIDPtr, + ffi.Pointer)>(); + + /// from: public final okhttp3.OkHttpClient$Builder eventListenerFactory(okhttp3.EventListener$Factory factory) + /// The returned object must be released after use, by calling the [release] method. + OkHttpClient_Builder eventListenerFactory( + jni.JObject factory0, + ) { + return _eventListenerFactory( + reference.pointer, + _id_eventListenerFactory as jni.JMethodIDPtr, + factory0.reference.pointer) + .object(const $OkHttpClient_BuilderType()); + } + + static final _id_retryOnConnectionFailure = _class.instanceMethodId( + r"retryOnConnectionFailure", + r"(Z)Lokhttp3/OkHttpClient$Builder;", + ); + + static final _retryOnConnectionFailure = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function(ffi.Pointer, jni.JMethodIDPtr, + ffi.VarArgs<(ffi.Int64,)>)>>("globalEnv_CallObjectMethod") + .asFunction< + jni.JniResult Function( + ffi.Pointer, jni.JMethodIDPtr, int)>(); + + /// from: public final okhttp3.OkHttpClient$Builder retryOnConnectionFailure(boolean z) + /// The returned object must be released after use, by calling the [release] method. + OkHttpClient_Builder retryOnConnectionFailure( + bool z, + ) { + return _retryOnConnectionFailure(reference.pointer, + _id_retryOnConnectionFailure as jni.JMethodIDPtr, z ? 1 : 0) + .object(const $OkHttpClient_BuilderType()); + } + + static final _id_authenticator = _class.instanceMethodId( + r"authenticator", + r"(Lokhttp3/Authenticator;)Lokhttp3/OkHttpClient$Builder;", + ); + + static final _authenticator = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + ffi.VarArgs<(ffi.Pointer,)>)>>( + "globalEnv_CallObjectMethod") + .asFunction< + jni.JniResult Function(ffi.Pointer, jni.JMethodIDPtr, + ffi.Pointer)>(); + + /// from: public final okhttp3.OkHttpClient$Builder authenticator(okhttp3.Authenticator authenticator) + /// The returned object must be released after use, by calling the [release] method. + OkHttpClient_Builder authenticator( + jni.JObject authenticator, + ) { + return _authenticator( + reference.pointer, + _id_authenticator as jni.JMethodIDPtr, + authenticator.reference.pointer) + .object(const $OkHttpClient_BuilderType()); + } + + static final _id_followRedirects = _class.instanceMethodId( + r"followRedirects", + r"(Z)Lokhttp3/OkHttpClient$Builder;", + ); + + static final _followRedirects = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function(ffi.Pointer, jni.JMethodIDPtr, + ffi.VarArgs<(ffi.Int64,)>)>>("globalEnv_CallObjectMethod") + .asFunction< + jni.JniResult Function( + ffi.Pointer, jni.JMethodIDPtr, int)>(); + + /// from: public final okhttp3.OkHttpClient$Builder followRedirects(boolean z) + /// The returned object must be released after use, by calling the [release] method. + OkHttpClient_Builder followRedirects( + bool z, + ) { + return _followRedirects(reference.pointer, + _id_followRedirects as jni.JMethodIDPtr, z ? 1 : 0) + .object(const $OkHttpClient_BuilderType()); + } + + static final _id_followSslRedirects = _class.instanceMethodId( + r"followSslRedirects", + r"(Z)Lokhttp3/OkHttpClient$Builder;", + ); + + static final _followSslRedirects = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function(ffi.Pointer, jni.JMethodIDPtr, + ffi.VarArgs<(ffi.Int64,)>)>>("globalEnv_CallObjectMethod") + .asFunction< + jni.JniResult Function( + ffi.Pointer, jni.JMethodIDPtr, int)>(); + + /// from: public final okhttp3.OkHttpClient$Builder followSslRedirects(boolean z) + /// The returned object must be released after use, by calling the [release] method. + OkHttpClient_Builder followSslRedirects( + bool z, + ) { + return _followSslRedirects(reference.pointer, + _id_followSslRedirects as jni.JMethodIDPtr, z ? 1 : 0) + .object(const $OkHttpClient_BuilderType()); + } + + static final _id_cookieJar = _class.instanceMethodId( + r"cookieJar", + r"(Lokhttp3/CookieJar;)Lokhttp3/OkHttpClient$Builder;", + ); + + static final _cookieJar = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + ffi.VarArgs<(ffi.Pointer,)>)>>( + "globalEnv_CallObjectMethod") + .asFunction< + jni.JniResult Function(ffi.Pointer, jni.JMethodIDPtr, + ffi.Pointer)>(); + + /// from: public final okhttp3.OkHttpClient$Builder cookieJar(okhttp3.CookieJar cookieJar) + /// The returned object must be released after use, by calling the [release] method. + OkHttpClient_Builder cookieJar( + jni.JObject cookieJar, + ) { + return _cookieJar(reference.pointer, _id_cookieJar as jni.JMethodIDPtr, + cookieJar.reference.pointer) + .object(const $OkHttpClient_BuilderType()); + } + + static final _id_cache = _class.instanceMethodId( + r"cache", + r"(Lokhttp3/Cache;)Lokhttp3/OkHttpClient$Builder;", + ); + + static final _cache = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + ffi.VarArgs<(ffi.Pointer,)>)>>( + "globalEnv_CallObjectMethod") + .asFunction< + jni.JniResult Function(ffi.Pointer, jni.JMethodIDPtr, + ffi.Pointer)>(); + + /// from: public final okhttp3.OkHttpClient$Builder cache(okhttp3.Cache cache) + /// The returned object must be released after use, by calling the [release] method. + OkHttpClient_Builder cache( + jni.JObject cache, + ) { + return _cache(reference.pointer, _id_cache as jni.JMethodIDPtr, + cache.reference.pointer) + .object(const $OkHttpClient_BuilderType()); + } + + static final _id_dns = _class.instanceMethodId( + r"dns", + r"(Lokhttp3/Dns;)Lokhttp3/OkHttpClient$Builder;", + ); + + static final _dns = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + ffi.VarArgs<(ffi.Pointer,)>)>>( + "globalEnv_CallObjectMethod") + .asFunction< + jni.JniResult Function(ffi.Pointer, jni.JMethodIDPtr, + ffi.Pointer)>(); + + /// from: public final okhttp3.OkHttpClient$Builder dns(okhttp3.Dns dns) + /// The returned object must be released after use, by calling the [release] method. + OkHttpClient_Builder dns( + jni.JObject dns, + ) { + return _dns(reference.pointer, _id_dns as jni.JMethodIDPtr, + dns.reference.pointer) + .object(const $OkHttpClient_BuilderType()); + } + + static final _id_proxy = _class.instanceMethodId( + r"proxy", + r"(Ljava/net/Proxy;)Lokhttp3/OkHttpClient$Builder;", + ); + + static final _proxy = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + ffi.VarArgs<(ffi.Pointer,)>)>>( + "globalEnv_CallObjectMethod") + .asFunction< + jni.JniResult Function(ffi.Pointer, jni.JMethodIDPtr, + ffi.Pointer)>(); + + /// from: public final okhttp3.OkHttpClient$Builder proxy(java.net.Proxy proxy) + /// The returned object must be released after use, by calling the [release] method. + OkHttpClient_Builder proxy( + jni.JObject proxy, + ) { + return _proxy(reference.pointer, _id_proxy as jni.JMethodIDPtr, + proxy.reference.pointer) + .object(const $OkHttpClient_BuilderType()); + } + + static final _id_proxySelector = _class.instanceMethodId( + r"proxySelector", + r"(Ljava/net/ProxySelector;)Lokhttp3/OkHttpClient$Builder;", + ); + + static final _proxySelector = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + ffi.VarArgs<(ffi.Pointer,)>)>>( + "globalEnv_CallObjectMethod") + .asFunction< + jni.JniResult Function(ffi.Pointer, jni.JMethodIDPtr, + ffi.Pointer)>(); + + /// from: public final okhttp3.OkHttpClient$Builder proxySelector(java.net.ProxySelector proxySelector) + /// The returned object must be released after use, by calling the [release] method. + OkHttpClient_Builder proxySelector( + jni.JObject proxySelector, + ) { + return _proxySelector( + reference.pointer, + _id_proxySelector as jni.JMethodIDPtr, + proxySelector.reference.pointer) + .object(const $OkHttpClient_BuilderType()); + } + + static final _id_proxyAuthenticator = _class.instanceMethodId( + r"proxyAuthenticator", + r"(Lokhttp3/Authenticator;)Lokhttp3/OkHttpClient$Builder;", + ); + + static final _proxyAuthenticator = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + ffi.VarArgs<(ffi.Pointer,)>)>>( + "globalEnv_CallObjectMethod") + .asFunction< + jni.JniResult Function(ffi.Pointer, jni.JMethodIDPtr, + ffi.Pointer)>(); + + /// from: public final okhttp3.OkHttpClient$Builder proxyAuthenticator(okhttp3.Authenticator authenticator) + /// The returned object must be released after use, by calling the [release] method. + OkHttpClient_Builder proxyAuthenticator( + jni.JObject authenticator, + ) { + return _proxyAuthenticator( + reference.pointer, + _id_proxyAuthenticator as jni.JMethodIDPtr, + authenticator.reference.pointer) + .object(const $OkHttpClient_BuilderType()); + } + + static final _id_socketFactory = _class.instanceMethodId( + r"socketFactory", + r"(Ljavax/net/SocketFactory;)Lokhttp3/OkHttpClient$Builder;", + ); + + static final _socketFactory = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + ffi.VarArgs<(ffi.Pointer,)>)>>( + "globalEnv_CallObjectMethod") + .asFunction< + jni.JniResult Function(ffi.Pointer, jni.JMethodIDPtr, + ffi.Pointer)>(); + + /// from: public final okhttp3.OkHttpClient$Builder socketFactory(javax.net.SocketFactory socketFactory) + /// The returned object must be released after use, by calling the [release] method. + OkHttpClient_Builder socketFactory( + jni.JObject socketFactory, + ) { + return _socketFactory( + reference.pointer, + _id_socketFactory as jni.JMethodIDPtr, + socketFactory.reference.pointer) + .object(const $OkHttpClient_BuilderType()); + } + + static final _id_sslSocketFactory = _class.instanceMethodId( + r"sslSocketFactory", + r"(Ljavax/net/ssl/SSLSocketFactory;)Lokhttp3/OkHttpClient$Builder;", + ); + + static final _sslSocketFactory = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + ffi.VarArgs<(ffi.Pointer,)>)>>( + "globalEnv_CallObjectMethod") + .asFunction< + jni.JniResult Function(ffi.Pointer, jni.JMethodIDPtr, + ffi.Pointer)>(); + + /// from: public final okhttp3.OkHttpClient$Builder sslSocketFactory(javax.net.ssl.SSLSocketFactory sSLSocketFactory) + /// The returned object must be released after use, by calling the [release] method. + OkHttpClient_Builder sslSocketFactory( + jni.JObject sSLSocketFactory, + ) { + return _sslSocketFactory( + reference.pointer, + _id_sslSocketFactory as jni.JMethodIDPtr, + sSLSocketFactory.reference.pointer) + .object(const $OkHttpClient_BuilderType()); + } + + static final _id_sslSocketFactory1 = _class.instanceMethodId( + r"sslSocketFactory", + r"(Ljavax/net/ssl/SSLSocketFactory;Ljavax/net/ssl/X509TrustManager;)Lokhttp3/OkHttpClient$Builder;", + ); + + static final _sslSocketFactory1 = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + ffi.VarArgs< + ( + ffi.Pointer, + ffi.Pointer + )>)>>("globalEnv_CallObjectMethod") + .asFunction< + jni.JniResult Function(ffi.Pointer, jni.JMethodIDPtr, + ffi.Pointer, ffi.Pointer)>(); + + /// from: public final okhttp3.OkHttpClient$Builder sslSocketFactory(javax.net.ssl.SSLSocketFactory sSLSocketFactory, javax.net.ssl.X509TrustManager x509TrustManager) + /// The returned object must be released after use, by calling the [release] method. + OkHttpClient_Builder sslSocketFactory1( + jni.JObject sSLSocketFactory, + jni.JObject x509TrustManager, + ) { + return _sslSocketFactory1( + reference.pointer, + _id_sslSocketFactory1 as jni.JMethodIDPtr, + sSLSocketFactory.reference.pointer, + x509TrustManager.reference.pointer) + .object(const $OkHttpClient_BuilderType()); + } + + static final _id_connectionSpecs = _class.instanceMethodId( + r"connectionSpecs", + r"(Ljava/util/List;)Lokhttp3/OkHttpClient$Builder;", + ); + + static final _connectionSpecs = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + ffi.VarArgs<(ffi.Pointer,)>)>>( + "globalEnv_CallObjectMethod") + .asFunction< + jni.JniResult Function(ffi.Pointer, jni.JMethodIDPtr, + ffi.Pointer)>(); + + /// from: public final okhttp3.OkHttpClient$Builder connectionSpecs(java.util.List list) + /// The returned object must be released after use, by calling the [release] method. + OkHttpClient_Builder connectionSpecs( + jni.JList list, + ) { + return _connectionSpecs(reference.pointer, + _id_connectionSpecs as jni.JMethodIDPtr, list.reference.pointer) + .object(const $OkHttpClient_BuilderType()); + } + + static final _id_protocols = _class.instanceMethodId( + r"protocols", + r"(Ljava/util/List;)Lokhttp3/OkHttpClient$Builder;", + ); + + static final _protocols = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + ffi.VarArgs<(ffi.Pointer,)>)>>( + "globalEnv_CallObjectMethod") + .asFunction< + jni.JniResult Function(ffi.Pointer, jni.JMethodIDPtr, + ffi.Pointer)>(); + + /// from: public final okhttp3.OkHttpClient$Builder protocols(java.util.List list) + /// The returned object must be released after use, by calling the [release] method. + OkHttpClient_Builder protocols( + jni.JList list, + ) { + return _protocols(reference.pointer, _id_protocols as jni.JMethodIDPtr, + list.reference.pointer) + .object(const $OkHttpClient_BuilderType()); + } + + static final _id_hostnameVerifier = _class.instanceMethodId( + r"hostnameVerifier", + r"(Ljavax/net/ssl/HostnameVerifier;)Lokhttp3/OkHttpClient$Builder;", + ); + + static final _hostnameVerifier = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + ffi.VarArgs<(ffi.Pointer,)>)>>( + "globalEnv_CallObjectMethod") + .asFunction< + jni.JniResult Function(ffi.Pointer, jni.JMethodIDPtr, + ffi.Pointer)>(); + + /// from: public final okhttp3.OkHttpClient$Builder hostnameVerifier(javax.net.ssl.HostnameVerifier hostnameVerifier) + /// The returned object must be released after use, by calling the [release] method. + OkHttpClient_Builder hostnameVerifier( + jni.JObject hostnameVerifier, + ) { + return _hostnameVerifier( + reference.pointer, + _id_hostnameVerifier as jni.JMethodIDPtr, + hostnameVerifier.reference.pointer) + .object(const $OkHttpClient_BuilderType()); + } + + static final _id_certificatePinner = _class.instanceMethodId( + r"certificatePinner", + r"(Lokhttp3/CertificatePinner;)Lokhttp3/OkHttpClient$Builder;", + ); + + static final _certificatePinner = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + ffi.VarArgs<(ffi.Pointer,)>)>>( + "globalEnv_CallObjectMethod") + .asFunction< + jni.JniResult Function(ffi.Pointer, jni.JMethodIDPtr, + ffi.Pointer)>(); + + /// from: public final okhttp3.OkHttpClient$Builder certificatePinner(okhttp3.CertificatePinner certificatePinner) + /// The returned object must be released after use, by calling the [release] method. + OkHttpClient_Builder certificatePinner( + jni.JObject certificatePinner, + ) { + return _certificatePinner( + reference.pointer, + _id_certificatePinner as jni.JMethodIDPtr, + certificatePinner.reference.pointer) + .object(const $OkHttpClient_BuilderType()); + } + + static final _id_callTimeout = _class.instanceMethodId( + r"callTimeout", + r"(JLjava/util/concurrent/TimeUnit;)Lokhttp3/OkHttpClient$Builder;", + ); + + static final _callTimeout = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + ffi.VarArgs<(ffi.Int64, ffi.Pointer)>)>>( + "globalEnv_CallObjectMethod") + .asFunction< + jni.JniResult Function(ffi.Pointer, jni.JMethodIDPtr, int, + ffi.Pointer)>(); + + /// from: public final okhttp3.OkHttpClient$Builder callTimeout(long j, java.util.concurrent.TimeUnit timeUnit) + /// The returned object must be released after use, by calling the [release] method. + OkHttpClient_Builder callTimeout( + int j, + jni.JObject timeUnit, + ) { + return _callTimeout(reference.pointer, _id_callTimeout as jni.JMethodIDPtr, + j, timeUnit.reference.pointer) + .object(const $OkHttpClient_BuilderType()); + } + + static final _id_callTimeout1 = _class.instanceMethodId( + r"callTimeout", + r"(Ljava/time/Duration;)Lokhttp3/OkHttpClient$Builder;", + ); + + static final _callTimeout1 = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + ffi.VarArgs<(ffi.Pointer,)>)>>( + "globalEnv_CallObjectMethod") + .asFunction< + jni.JniResult Function(ffi.Pointer, jni.JMethodIDPtr, + ffi.Pointer)>(); + + /// from: public final okhttp3.OkHttpClient$Builder callTimeout(java.time.Duration duration) + /// The returned object must be released after use, by calling the [release] method. + OkHttpClient_Builder callTimeout1( + jni.JObject duration, + ) { + return _callTimeout1(reference.pointer, + _id_callTimeout1 as jni.JMethodIDPtr, duration.reference.pointer) + .object(const $OkHttpClient_BuilderType()); + } + + static final _id_connectTimeout = _class.instanceMethodId( + r"connectTimeout", + r"(JLjava/util/concurrent/TimeUnit;)Lokhttp3/OkHttpClient$Builder;", + ); + + static final _connectTimeout = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + ffi.VarArgs<(ffi.Int64, ffi.Pointer)>)>>( + "globalEnv_CallObjectMethod") + .asFunction< + jni.JniResult Function(ffi.Pointer, jni.JMethodIDPtr, int, + ffi.Pointer)>(); + + /// from: public final okhttp3.OkHttpClient$Builder connectTimeout(long j, java.util.concurrent.TimeUnit timeUnit) + /// The returned object must be released after use, by calling the [release] method. + OkHttpClient_Builder connectTimeout( + int j, + jni.JObject timeUnit, + ) { + return _connectTimeout( + reference.pointer, + _id_connectTimeout as jni.JMethodIDPtr, + j, + timeUnit.reference.pointer) + .object(const $OkHttpClient_BuilderType()); + } + + static final _id_connectTimeout1 = _class.instanceMethodId( + r"connectTimeout", + r"(Ljava/time/Duration;)Lokhttp3/OkHttpClient$Builder;", + ); + + static final _connectTimeout1 = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + ffi.VarArgs<(ffi.Pointer,)>)>>( + "globalEnv_CallObjectMethod") + .asFunction< + jni.JniResult Function(ffi.Pointer, jni.JMethodIDPtr, + ffi.Pointer)>(); + + /// from: public final okhttp3.OkHttpClient$Builder connectTimeout(java.time.Duration duration) + /// The returned object must be released after use, by calling the [release] method. + OkHttpClient_Builder connectTimeout1( + jni.JObject duration, + ) { + return _connectTimeout1(reference.pointer, + _id_connectTimeout1 as jni.JMethodIDPtr, duration.reference.pointer) + .object(const $OkHttpClient_BuilderType()); + } + + static final _id_readTimeout = _class.instanceMethodId( + r"readTimeout", + r"(JLjava/util/concurrent/TimeUnit;)Lokhttp3/OkHttpClient$Builder;", + ); + + static final _readTimeout = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + ffi.VarArgs<(ffi.Int64, ffi.Pointer)>)>>( + "globalEnv_CallObjectMethod") + .asFunction< + jni.JniResult Function(ffi.Pointer, jni.JMethodIDPtr, int, + ffi.Pointer)>(); + + /// from: public final okhttp3.OkHttpClient$Builder readTimeout(long j, java.util.concurrent.TimeUnit timeUnit) + /// The returned object must be released after use, by calling the [release] method. + OkHttpClient_Builder readTimeout( + int j, + jni.JObject timeUnit, + ) { + return _readTimeout(reference.pointer, _id_readTimeout as jni.JMethodIDPtr, + j, timeUnit.reference.pointer) + .object(const $OkHttpClient_BuilderType()); + } + + static final _id_readTimeout1 = _class.instanceMethodId( + r"readTimeout", + r"(Ljava/time/Duration;)Lokhttp3/OkHttpClient$Builder;", + ); + + static final _readTimeout1 = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + ffi.VarArgs<(ffi.Pointer,)>)>>( + "globalEnv_CallObjectMethod") + .asFunction< + jni.JniResult Function(ffi.Pointer, jni.JMethodIDPtr, + ffi.Pointer)>(); + + /// from: public final okhttp3.OkHttpClient$Builder readTimeout(java.time.Duration duration) + /// The returned object must be released after use, by calling the [release] method. + OkHttpClient_Builder readTimeout1( + jni.JObject duration, + ) { + return _readTimeout1(reference.pointer, + _id_readTimeout1 as jni.JMethodIDPtr, duration.reference.pointer) + .object(const $OkHttpClient_BuilderType()); + } + + static final _id_writeTimeout = _class.instanceMethodId( + r"writeTimeout", + r"(JLjava/util/concurrent/TimeUnit;)Lokhttp3/OkHttpClient$Builder;", + ); + + static final _writeTimeout = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + ffi.VarArgs<(ffi.Int64, ffi.Pointer)>)>>( + "globalEnv_CallObjectMethod") + .asFunction< + jni.JniResult Function(ffi.Pointer, jni.JMethodIDPtr, int, + ffi.Pointer)>(); + + /// from: public final okhttp3.OkHttpClient$Builder writeTimeout(long j, java.util.concurrent.TimeUnit timeUnit) + /// The returned object must be released after use, by calling the [release] method. + OkHttpClient_Builder writeTimeout( + int j, + jni.JObject timeUnit, + ) { + return _writeTimeout(reference.pointer, + _id_writeTimeout as jni.JMethodIDPtr, j, timeUnit.reference.pointer) + .object(const $OkHttpClient_BuilderType()); + } + + static final _id_writeTimeout1 = _class.instanceMethodId( + r"writeTimeout", + r"(Ljava/time/Duration;)Lokhttp3/OkHttpClient$Builder;", + ); + + static final _writeTimeout1 = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + ffi.VarArgs<(ffi.Pointer,)>)>>( + "globalEnv_CallObjectMethod") + .asFunction< + jni.JniResult Function(ffi.Pointer, jni.JMethodIDPtr, + ffi.Pointer)>(); + + /// from: public final okhttp3.OkHttpClient$Builder writeTimeout(java.time.Duration duration) + /// The returned object must be released after use, by calling the [release] method. + OkHttpClient_Builder writeTimeout1( + jni.JObject duration, + ) { + return _writeTimeout1(reference.pointer, + _id_writeTimeout1 as jni.JMethodIDPtr, duration.reference.pointer) + .object(const $OkHttpClient_BuilderType()); + } + + static final _id_pingInterval = _class.instanceMethodId( + r"pingInterval", + r"(JLjava/util/concurrent/TimeUnit;)Lokhttp3/OkHttpClient$Builder;", + ); + + static final _pingInterval = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + ffi.VarArgs<(ffi.Int64, ffi.Pointer)>)>>( + "globalEnv_CallObjectMethod") + .asFunction< + jni.JniResult Function(ffi.Pointer, jni.JMethodIDPtr, int, + ffi.Pointer)>(); + + /// from: public final okhttp3.OkHttpClient$Builder pingInterval(long j, java.util.concurrent.TimeUnit timeUnit) + /// The returned object must be released after use, by calling the [release] method. + OkHttpClient_Builder pingInterval( + int j, + jni.JObject timeUnit, + ) { + return _pingInterval(reference.pointer, + _id_pingInterval as jni.JMethodIDPtr, j, timeUnit.reference.pointer) + .object(const $OkHttpClient_BuilderType()); + } + + static final _id_pingInterval1 = _class.instanceMethodId( + r"pingInterval", + r"(Ljava/time/Duration;)Lokhttp3/OkHttpClient$Builder;", + ); + + static final _pingInterval1 = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + ffi.VarArgs<(ffi.Pointer,)>)>>( + "globalEnv_CallObjectMethod") + .asFunction< + jni.JniResult Function(ffi.Pointer, jni.JMethodIDPtr, + ffi.Pointer)>(); + + /// from: public final okhttp3.OkHttpClient$Builder pingInterval(java.time.Duration duration) + /// The returned object must be released after use, by calling the [release] method. + OkHttpClient_Builder pingInterval1( + jni.JObject duration, + ) { + return _pingInterval1(reference.pointer, + _id_pingInterval1 as jni.JMethodIDPtr, duration.reference.pointer) + .object(const $OkHttpClient_BuilderType()); + } + + static final _id_minWebSocketMessageToCompress = _class.instanceMethodId( + r"minWebSocketMessageToCompress", + r"(J)Lokhttp3/OkHttpClient$Builder;", + ); + + static final _minWebSocketMessageToCompress = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function(ffi.Pointer, jni.JMethodIDPtr, + ffi.VarArgs<(ffi.Int64,)>)>>("globalEnv_CallObjectMethod") + .asFunction< + jni.JniResult Function( + ffi.Pointer, jni.JMethodIDPtr, int)>(); + + /// from: public final okhttp3.OkHttpClient$Builder minWebSocketMessageToCompress(long j) + /// The returned object must be released after use, by calling the [release] method. + OkHttpClient_Builder minWebSocketMessageToCompress( + int j, + ) { + return _minWebSocketMessageToCompress(reference.pointer, + _id_minWebSocketMessageToCompress as jni.JMethodIDPtr, j) + .object(const $OkHttpClient_BuilderType()); + } + + static final _id_build = _class.instanceMethodId( + r"build", + r"()Lokhttp3/OkHttpClient;", + ); + + static final _build = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + )>>("globalEnv_CallObjectMethod") + .asFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + )>(); + + /// from: public final okhttp3.OkHttpClient build() + /// The returned object must be released after use, by calling the [release] method. + OkHttpClient build() { + return _build(reference.pointer, _id_build as jni.JMethodIDPtr) + .object(const $OkHttpClientType()); + } +} + +final class $OkHttpClient_BuilderType + extends jni.JObjType { + const $OkHttpClient_BuilderType(); + + @override + String get signature => r"Lokhttp3/OkHttpClient$Builder;"; + + @override + OkHttpClient_Builder fromReference(jni.JReference reference) => + OkHttpClient_Builder.fromReference(reference); + + @override + jni.JObjType get superType => const jni.JObjectType(); + + @override + final superCount = 1; + + @override + int get hashCode => ($OkHttpClient_BuilderType).hashCode; + + @override + bool operator ==(Object other) { + return other.runtimeType == ($OkHttpClient_BuilderType) && + other is $OkHttpClient_BuilderType; + } +} + +/// from: okhttp3.OkHttpClient$Companion +class OkHttpClient_Companion extends jni.JObject { + @override + late final jni.JObjType $type = type; + + OkHttpClient_Companion.fromReference( + jni.JReference reference, + ) : super.fromReference(reference); + + static final _class = jni.JClass.forName(r"okhttp3/OkHttpClient$Companion"); + + /// The type which includes information such as the signature of this class. + static const type = $OkHttpClient_CompanionType(); + static final _id_new0 = _class.constructorId( + r"(Lkotlin/jvm/internal/DefaultConstructorMarker;)V", + ); + + static final _new0 = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + ffi.VarArgs<(ffi.Pointer,)>)>>( + "globalEnv_NewObject") + .asFunction< + jni.JniResult Function(ffi.Pointer, jni.JMethodIDPtr, + ffi.Pointer)>(); + + /// from: public void (kotlin.jvm.internal.DefaultConstructorMarker defaultConstructorMarker) + /// The returned object must be released after use, by calling the [release] method. + factory OkHttpClient_Companion( + jni.JObject defaultConstructorMarker, + ) { + return OkHttpClient_Companion.fromReference(_new0( + _class.reference.pointer, + _id_new0 as jni.JMethodIDPtr, + defaultConstructorMarker.reference.pointer) + .reference); + } +} + +final class $OkHttpClient_CompanionType + extends jni.JObjType { + const $OkHttpClient_CompanionType(); + + @override + String get signature => r"Lokhttp3/OkHttpClient$Companion;"; + + @override + OkHttpClient_Companion fromReference(jni.JReference reference) => + OkHttpClient_Companion.fromReference(reference); + + @override + jni.JObjType get superType => const jni.JObjectType(); + + @override + final superCount = 1; + + @override + int get hashCode => ($OkHttpClient_CompanionType).hashCode; + + @override + bool operator ==(Object other) { + return other.runtimeType == ($OkHttpClient_CompanionType) && + other is $OkHttpClient_CompanionType; + } +} + +/// from: okhttp3.OkHttpClient +class OkHttpClient extends jni.JObject { + @override + late final jni.JObjType $type = type; + + OkHttpClient.fromReference( + jni.JReference reference, + ) : super.fromReference(reference); + + static final _class = jni.JClass.forName(r"okhttp3/OkHttpClient"); + + /// The type which includes information such as the signature of this class. + static const type = $OkHttpClientType(); + static final _id_Companion = _class.staticFieldId( + r"Companion", + r"Lokhttp3/OkHttpClient$Companion;", + ); + + /// from: static public final okhttp3.OkHttpClient$Companion Companion + /// The returned object must be released after use, by calling the [release] method. + static OkHttpClient_Companion get Companion => + _id_Companion.get(_class, const $OkHttpClient_CompanionType()); + + static final _id_new0 = _class.constructorId( + r"(Lokhttp3/OkHttpClient$Builder;)V", + ); + + static final _new0 = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + ffi.VarArgs<(ffi.Pointer,)>)>>( + "globalEnv_NewObject") + .asFunction< + jni.JniResult Function(ffi.Pointer, jni.JMethodIDPtr, + ffi.Pointer)>(); + + /// from: public void (okhttp3.OkHttpClient$Builder builder) + /// The returned object must be released after use, by calling the [release] method. + factory OkHttpClient( + OkHttpClient_Builder builder, + ) { + return OkHttpClient.fromReference(_new0(_class.reference.pointer, + _id_new0 as jni.JMethodIDPtr, builder.reference.pointer) + .reference); + } + + static final _id_dispatcher = _class.instanceMethodId( + r"dispatcher", + r"()Lokhttp3/Dispatcher;", + ); + + static final _dispatcher = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + )>>("globalEnv_CallObjectMethod") + .asFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + )>(); + + /// from: public final okhttp3.Dispatcher dispatcher() + /// The returned object must be released after use, by calling the [release] method. + jni.JObject dispatcher() { + return _dispatcher(reference.pointer, _id_dispatcher as jni.JMethodIDPtr) + .object(const jni.JObjectType()); + } + + static final _id_connectionPool = _class.instanceMethodId( + r"connectionPool", + r"()Lokhttp3/ConnectionPool;", + ); + + static final _connectionPool = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + )>>("globalEnv_CallObjectMethod") + .asFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + )>(); + + /// from: public final okhttp3.ConnectionPool connectionPool() + /// The returned object must be released after use, by calling the [release] method. + jni.JObject connectionPool() { + return _connectionPool( + reference.pointer, _id_connectionPool as jni.JMethodIDPtr) + .object(const jni.JObjectType()); + } + + static final _id_interceptors = _class.instanceMethodId( + r"interceptors", + r"()Ljava/util/List;", + ); + + static final _interceptors = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + )>>("globalEnv_CallObjectMethod") + .asFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + )>(); + + /// from: public final java.util.List interceptors() + /// The returned object must be released after use, by calling the [release] method. + jni.JList interceptors() { + return _interceptors( + reference.pointer, _id_interceptors as jni.JMethodIDPtr) + .object(const jni.JListType(jni.JObjectType())); + } + + static final _id_networkInterceptors = _class.instanceMethodId( + r"networkInterceptors", + r"()Ljava/util/List;", + ); + + static final _networkInterceptors = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + )>>("globalEnv_CallObjectMethod") + .asFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + )>(); + + /// from: public final java.util.List networkInterceptors() + /// The returned object must be released after use, by calling the [release] method. + jni.JList networkInterceptors() { + return _networkInterceptors( + reference.pointer, _id_networkInterceptors as jni.JMethodIDPtr) + .object(const jni.JListType(jni.JObjectType())); + } + + static final _id_eventListenerFactory = _class.instanceMethodId( + r"eventListenerFactory", + r"()Lokhttp3/EventListener$Factory;", + ); + + static final _eventListenerFactory = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + )>>("globalEnv_CallObjectMethod") + .asFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + )>(); + + /// from: public final okhttp3.EventListener$Factory eventListenerFactory() + /// The returned object must be released after use, by calling the [release] method. + jni.JObject eventListenerFactory() { + return _eventListenerFactory( + reference.pointer, _id_eventListenerFactory as jni.JMethodIDPtr) + .object(const jni.JObjectType()); + } + + static final _id_retryOnConnectionFailure = _class.instanceMethodId( + r"retryOnConnectionFailure", + r"()Z", + ); + + static final _retryOnConnectionFailure = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + )>>("globalEnv_CallBooleanMethod") + .asFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + )>(); + + /// from: public final boolean retryOnConnectionFailure() + bool retryOnConnectionFailure() { + return _retryOnConnectionFailure( + reference.pointer, _id_retryOnConnectionFailure as jni.JMethodIDPtr) + .boolean; + } + + static final _id_authenticator = _class.instanceMethodId( + r"authenticator", + r"()Lokhttp3/Authenticator;", + ); + + static final _authenticator = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + )>>("globalEnv_CallObjectMethod") + .asFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + )>(); + + /// from: public final okhttp3.Authenticator authenticator() + /// The returned object must be released after use, by calling the [release] method. + jni.JObject authenticator() { + return _authenticator( + reference.pointer, _id_authenticator as jni.JMethodIDPtr) + .object(const jni.JObjectType()); + } + + static final _id_followRedirects = _class.instanceMethodId( + r"followRedirects", + r"()Z", + ); + + static final _followRedirects = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + )>>("globalEnv_CallBooleanMethod") + .asFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + )>(); + + /// from: public final boolean followRedirects() + bool followRedirects() { + return _followRedirects( + reference.pointer, _id_followRedirects as jni.JMethodIDPtr) + .boolean; + } + + static final _id_followSslRedirects = _class.instanceMethodId( + r"followSslRedirects", + r"()Z", + ); + + static final _followSslRedirects = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + )>>("globalEnv_CallBooleanMethod") + .asFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + )>(); + + /// from: public final boolean followSslRedirects() + bool followSslRedirects() { + return _followSslRedirects( + reference.pointer, _id_followSslRedirects as jni.JMethodIDPtr) + .boolean; + } + + static final _id_cookieJar = _class.instanceMethodId( + r"cookieJar", + r"()Lokhttp3/CookieJar;", + ); + + static final _cookieJar = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + )>>("globalEnv_CallObjectMethod") + .asFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + )>(); + + /// from: public final okhttp3.CookieJar cookieJar() + /// The returned object must be released after use, by calling the [release] method. + jni.JObject cookieJar() { + return _cookieJar(reference.pointer, _id_cookieJar as jni.JMethodIDPtr) + .object(const jni.JObjectType()); + } + + static final _id_cache = _class.instanceMethodId( + r"cache", + r"()Lokhttp3/Cache;", + ); + + static final _cache = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + )>>("globalEnv_CallObjectMethod") + .asFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + )>(); + + /// from: public final okhttp3.Cache cache() + /// The returned object must be released after use, by calling the [release] method. + jni.JObject cache() { + return _cache(reference.pointer, _id_cache as jni.JMethodIDPtr) + .object(const jni.JObjectType()); + } + + static final _id_dns = _class.instanceMethodId( + r"dns", + r"()Lokhttp3/Dns;", + ); + + static final _dns = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + )>>("globalEnv_CallObjectMethod") + .asFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + )>(); + + /// from: public final okhttp3.Dns dns() + /// The returned object must be released after use, by calling the [release] method. + jni.JObject dns() { + return _dns(reference.pointer, _id_dns as jni.JMethodIDPtr) + .object(const jni.JObjectType()); + } + + static final _id_proxy = _class.instanceMethodId( + r"proxy", + r"()Ljava/net/Proxy;", + ); + + static final _proxy = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + )>>("globalEnv_CallObjectMethod") + .asFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + )>(); + + /// from: public final java.net.Proxy proxy() + /// The returned object must be released after use, by calling the [release] method. + jni.JObject proxy() { + return _proxy(reference.pointer, _id_proxy as jni.JMethodIDPtr) + .object(const jni.JObjectType()); + } + + static final _id_proxySelector = _class.instanceMethodId( + r"proxySelector", + r"()Ljava/net/ProxySelector;", + ); + + static final _proxySelector = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + )>>("globalEnv_CallObjectMethod") + .asFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + )>(); + + /// from: public final java.net.ProxySelector proxySelector() + /// The returned object must be released after use, by calling the [release] method. + jni.JObject proxySelector() { + return _proxySelector( + reference.pointer, _id_proxySelector as jni.JMethodIDPtr) + .object(const jni.JObjectType()); + } + + static final _id_proxyAuthenticator = _class.instanceMethodId( + r"proxyAuthenticator", + r"()Lokhttp3/Authenticator;", + ); + + static final _proxyAuthenticator = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + )>>("globalEnv_CallObjectMethod") + .asFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + )>(); + + /// from: public final okhttp3.Authenticator proxyAuthenticator() + /// The returned object must be released after use, by calling the [release] method. + jni.JObject proxyAuthenticator() { + return _proxyAuthenticator( + reference.pointer, _id_proxyAuthenticator as jni.JMethodIDPtr) + .object(const jni.JObjectType()); + } + + static final _id_socketFactory = _class.instanceMethodId( + r"socketFactory", + r"()Ljavax/net/SocketFactory;", + ); + + static final _socketFactory = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + )>>("globalEnv_CallObjectMethod") + .asFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + )>(); + + /// from: public final javax.net.SocketFactory socketFactory() + /// The returned object must be released after use, by calling the [release] method. + jni.JObject socketFactory() { + return _socketFactory( + reference.pointer, _id_socketFactory as jni.JMethodIDPtr) + .object(const jni.JObjectType()); + } + + static final _id_sslSocketFactory = _class.instanceMethodId( + r"sslSocketFactory", + r"()Ljavax/net/ssl/SSLSocketFactory;", + ); + + static final _sslSocketFactory = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + )>>("globalEnv_CallObjectMethod") + .asFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + )>(); + + /// from: public final javax.net.ssl.SSLSocketFactory sslSocketFactory() + /// The returned object must be released after use, by calling the [release] method. + jni.JObject sslSocketFactory() { + return _sslSocketFactory( + reference.pointer, _id_sslSocketFactory as jni.JMethodIDPtr) + .object(const jni.JObjectType()); + } + + static final _id_x509TrustManager = _class.instanceMethodId( + r"x509TrustManager", + r"()Ljavax/net/ssl/X509TrustManager;", + ); + + static final _x509TrustManager = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + )>>("globalEnv_CallObjectMethod") + .asFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + )>(); + + /// from: public final javax.net.ssl.X509TrustManager x509TrustManager() + /// The returned object must be released after use, by calling the [release] method. + jni.JObject x509TrustManager() { + return _x509TrustManager( + reference.pointer, _id_x509TrustManager as jni.JMethodIDPtr) + .object(const jni.JObjectType()); + } + + static final _id_connectionSpecs = _class.instanceMethodId( + r"connectionSpecs", + r"()Ljava/util/List;", + ); + + static final _connectionSpecs = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + )>>("globalEnv_CallObjectMethod") + .asFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + )>(); + + /// from: public final java.util.List connectionSpecs() + /// The returned object must be released after use, by calling the [release] method. + jni.JList connectionSpecs() { + return _connectionSpecs( + reference.pointer, _id_connectionSpecs as jni.JMethodIDPtr) + .object(const jni.JListType(jni.JObjectType())); + } + + static final _id_protocols = _class.instanceMethodId( + r"protocols", + r"()Ljava/util/List;", + ); + + static final _protocols = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + )>>("globalEnv_CallObjectMethod") + .asFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + )>(); + + /// from: public final java.util.List protocols() + /// The returned object must be released after use, by calling the [release] method. + jni.JList protocols() { + return _protocols(reference.pointer, _id_protocols as jni.JMethodIDPtr) + .object(const jni.JListType(jni.JObjectType())); + } + + static final _id_hostnameVerifier = _class.instanceMethodId( + r"hostnameVerifier", + r"()Ljavax/net/ssl/HostnameVerifier;", + ); + + static final _hostnameVerifier = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + )>>("globalEnv_CallObjectMethod") + .asFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + )>(); + + /// from: public final javax.net.ssl.HostnameVerifier hostnameVerifier() + /// The returned object must be released after use, by calling the [release] method. + jni.JObject hostnameVerifier() { + return _hostnameVerifier( + reference.pointer, _id_hostnameVerifier as jni.JMethodIDPtr) + .object(const jni.JObjectType()); + } + + static final _id_certificatePinner = _class.instanceMethodId( + r"certificatePinner", + r"()Lokhttp3/CertificatePinner;", + ); + + static final _certificatePinner = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + )>>("globalEnv_CallObjectMethod") + .asFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + )>(); + + /// from: public final okhttp3.CertificatePinner certificatePinner() + /// The returned object must be released after use, by calling the [release] method. + jni.JObject certificatePinner() { + return _certificatePinner( + reference.pointer, _id_certificatePinner as jni.JMethodIDPtr) + .object(const jni.JObjectType()); + } + + static final _id_certificateChainCleaner = _class.instanceMethodId( + r"certificateChainCleaner", + r"()Lokhttp3/internal/tls/CertificateChainCleaner;", + ); + + static final _certificateChainCleaner = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + )>>("globalEnv_CallObjectMethod") + .asFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + )>(); + + /// from: public final okhttp3.internal.tls.CertificateChainCleaner certificateChainCleaner() + /// The returned object must be released after use, by calling the [release] method. + jni.JObject certificateChainCleaner() { + return _certificateChainCleaner( + reference.pointer, _id_certificateChainCleaner as jni.JMethodIDPtr) + .object(const jni.JObjectType()); + } + + static final _id_callTimeoutMillis = _class.instanceMethodId( + r"callTimeoutMillis", + r"()I", + ); + + static final _callTimeoutMillis = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + )>>("globalEnv_CallIntMethod") + .asFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + )>(); + + /// from: public final int callTimeoutMillis() + int callTimeoutMillis() { + return _callTimeoutMillis( + reference.pointer, _id_callTimeoutMillis as jni.JMethodIDPtr) + .integer; + } + + static final _id_connectTimeoutMillis = _class.instanceMethodId( + r"connectTimeoutMillis", + r"()I", + ); + + static final _connectTimeoutMillis = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + )>>("globalEnv_CallIntMethod") + .asFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + )>(); + + /// from: public final int connectTimeoutMillis() + int connectTimeoutMillis() { + return _connectTimeoutMillis( + reference.pointer, _id_connectTimeoutMillis as jni.JMethodIDPtr) + .integer; + } + + static final _id_readTimeoutMillis = _class.instanceMethodId( + r"readTimeoutMillis", + r"()I", + ); + + static final _readTimeoutMillis = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + )>>("globalEnv_CallIntMethod") + .asFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + )>(); + + /// from: public final int readTimeoutMillis() + int readTimeoutMillis() { + return _readTimeoutMillis( + reference.pointer, _id_readTimeoutMillis as jni.JMethodIDPtr) + .integer; + } + + static final _id_writeTimeoutMillis = _class.instanceMethodId( + r"writeTimeoutMillis", + r"()I", + ); + + static final _writeTimeoutMillis = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + )>>("globalEnv_CallIntMethod") + .asFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + )>(); + + /// from: public final int writeTimeoutMillis() + int writeTimeoutMillis() { + return _writeTimeoutMillis( + reference.pointer, _id_writeTimeoutMillis as jni.JMethodIDPtr) + .integer; + } + + static final _id_pingIntervalMillis = _class.instanceMethodId( + r"pingIntervalMillis", + r"()I", + ); + + static final _pingIntervalMillis = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + )>>("globalEnv_CallIntMethod") + .asFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + )>(); + + /// from: public final int pingIntervalMillis() + int pingIntervalMillis() { + return _pingIntervalMillis( + reference.pointer, _id_pingIntervalMillis as jni.JMethodIDPtr) + .integer; + } + + static final _id_minWebSocketMessageToCompress = _class.instanceMethodId( + r"minWebSocketMessageToCompress", + r"()J", + ); + + static final _minWebSocketMessageToCompress = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + )>>("globalEnv_CallLongMethod") + .asFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + )>(); + + /// from: public final long minWebSocketMessageToCompress() + int minWebSocketMessageToCompress() { + return _minWebSocketMessageToCompress(reference.pointer, + _id_minWebSocketMessageToCompress as jni.JMethodIDPtr) + .long; + } + + static final _id_getRouteDatabase = _class.instanceMethodId( + r"getRouteDatabase", + r"()Lokhttp3/internal/connection/RouteDatabase;", + ); + + static final _getRouteDatabase = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + )>>("globalEnv_CallObjectMethod") + .asFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + )>(); + + /// from: public final okhttp3.internal.connection.RouteDatabase getRouteDatabase() + /// The returned object must be released after use, by calling the [release] method. + jni.JObject getRouteDatabase() { + return _getRouteDatabase( + reference.pointer, _id_getRouteDatabase as jni.JMethodIDPtr) + .object(const jni.JObjectType()); + } + + static final _id_new1 = _class.constructorId( + r"()V", + ); + + static final _new1 = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + )>>("globalEnv_NewObject") + .asFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + )>(); + + /// from: public void () + /// The returned object must be released after use, by calling the [release] method. + factory OkHttpClient.new1() { + return OkHttpClient.fromReference( + _new1(_class.reference.pointer, _id_new1 as jni.JMethodIDPtr) + .reference); + } + + static final _id_newCall = _class.instanceMethodId( + r"newCall", + r"(Lokhttp3/Request;)Lokhttp3/Call;", + ); + + static final _newCall = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + ffi.VarArgs<(ffi.Pointer,)>)>>( + "globalEnv_CallObjectMethod") + .asFunction< + jni.JniResult Function(ffi.Pointer, jni.JMethodIDPtr, + ffi.Pointer)>(); + + /// from: public okhttp3.Call newCall(okhttp3.Request request) + /// The returned object must be released after use, by calling the [release] method. + call_.Call newCall( + request_.Request request, + ) { + return _newCall(reference.pointer, _id_newCall as jni.JMethodIDPtr, + request.reference.pointer) + .object(const call_.$CallType()); + } + + static final _id_newWebSocket = _class.instanceMethodId( + r"newWebSocket", + r"(Lokhttp3/Request;Lokhttp3/WebSocketListener;)Lokhttp3/WebSocket;", + ); + + static final _newWebSocket = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + ffi.VarArgs< + ( + ffi.Pointer, + ffi.Pointer + )>)>>("globalEnv_CallObjectMethod") + .asFunction< + jni.JniResult Function(ffi.Pointer, jni.JMethodIDPtr, + ffi.Pointer, ffi.Pointer)>(); + + /// from: public okhttp3.WebSocket newWebSocket(okhttp3.Request request, okhttp3.WebSocketListener webSocketListener) + /// The returned object must be released after use, by calling the [release] method. + jni.JObject newWebSocket( + request_.Request request, + jni.JObject webSocketListener, + ) { + return _newWebSocket( + reference.pointer, + _id_newWebSocket as jni.JMethodIDPtr, + request.reference.pointer, + webSocketListener.reference.pointer) + .object(const jni.JObjectType()); + } + + static final _id_newBuilder = _class.instanceMethodId( + r"newBuilder", + r"()Lokhttp3/OkHttpClient$Builder;", + ); + + static final _newBuilder = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + )>>("globalEnv_CallObjectMethod") + .asFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + )>(); + + /// from: public okhttp3.OkHttpClient$Builder newBuilder() + /// The returned object must be released after use, by calling the [release] method. + OkHttpClient_Builder newBuilder() { + return _newBuilder(reference.pointer, _id_newBuilder as jni.JMethodIDPtr) + .object(const $OkHttpClient_BuilderType()); + } + + static final _id_clone = _class.instanceMethodId( + r"clone", + r"()Ljava/lang/Object;", + ); + + static final _clone = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + )>>("globalEnv_CallObjectMethod") + .asFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + )>(); + + /// from: public java.lang.Object clone() + /// The returned object must be released after use, by calling the [release] method. + jni.JObject clone() { + return _clone(reference.pointer, _id_clone as jni.JMethodIDPtr) + .object(const jni.JObjectType()); + } +} + +final class $OkHttpClientType extends jni.JObjType { + const $OkHttpClientType(); + + @override + String get signature => r"Lokhttp3/OkHttpClient;"; + + @override + OkHttpClient fromReference(jni.JReference reference) => + OkHttpClient.fromReference(reference); + + @override + jni.JObjType get superType => const jni.JObjectType(); + + @override + final superCount = 1; + + @override + int get hashCode => ($OkHttpClientType).hashCode; + + @override + bool operator ==(Object other) { + return other.runtimeType == ($OkHttpClientType) && + other is $OkHttpClientType; + } +} diff --git a/pkgs/ok_http/lib/src/third_party/okhttp3/Request.dart b/pkgs/ok_http/lib/src/third_party/okhttp3/Request.dart new file mode 100644 index 0000000000..6b7c28d82e --- /dev/null +++ b/pkgs/ok_http/lib/src/third_party/okhttp3/Request.dart @@ -0,0 +1,1005 @@ +// Autogenerated by jnigen. DO NOT EDIT! + +// ignore_for_file: annotate_overrides +// ignore_for_file: camel_case_extensions +// ignore_for_file: camel_case_types +// ignore_for_file: constant_identifier_names +// ignore_for_file: doc_directive_unknown +// ignore_for_file: file_names +// ignore_for_file: lines_longer_than_80_chars +// ignore_for_file: no_leading_underscores_for_local_identifiers +// ignore_for_file: non_constant_identifier_names +// ignore_for_file: overridden_fields +// ignore_for_file: unnecessary_cast +// ignore_for_file: unused_element +// ignore_for_file: unused_field +// ignore_for_file: unused_import +// ignore_for_file: unused_local_variable +// ignore_for_file: unused_shown_name +// ignore_for_file: use_super_parameters + +import "dart:isolate" show ReceivePort; +import "dart:ffi" as ffi; +import "package:jni/internal_helpers_for_jnigen.dart"; +import "package:jni/jni.dart" as jni; + +import "Headers.dart" as headers_; + +import "RequestBody.dart" as requestbody_; + +/// from: okhttp3.Request$Builder +class Request_Builder extends jni.JObject { + @override + late final jni.JObjType $type = type; + + Request_Builder.fromReference( + jni.JReference reference, + ) : super.fromReference(reference); + + static final _class = jni.JClass.forName(r"okhttp3/Request$Builder"); + + /// The type which includes information such as the signature of this class. + static const type = $Request_BuilderType(); + static final _id_new0 = _class.constructorId( + r"()V", + ); + + static final _new0 = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + )>>("globalEnv_NewObject") + .asFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + )>(); + + /// from: public void () + /// The returned object must be released after use, by calling the [release] method. + factory Request_Builder() { + return Request_Builder.fromReference( + _new0(_class.reference.pointer, _id_new0 as jni.JMethodIDPtr) + .reference); + } + + static final _id_new1 = _class.constructorId( + r"(Lokhttp3/Request;)V", + ); + + static final _new1 = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + ffi.VarArgs<(ffi.Pointer,)>)>>( + "globalEnv_NewObject") + .asFunction< + jni.JniResult Function(ffi.Pointer, jni.JMethodIDPtr, + ffi.Pointer)>(); + + /// from: public void (okhttp3.Request request) + /// The returned object must be released after use, by calling the [release] method. + factory Request_Builder.new1( + Request request, + ) { + return Request_Builder.fromReference(_new1(_class.reference.pointer, + _id_new1 as jni.JMethodIDPtr, request.reference.pointer) + .reference); + } + + static final _id_url = _class.instanceMethodId( + r"url", + r"(Lokhttp3/HttpUrl;)Lokhttp3/Request$Builder;", + ); + + static final _url = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + ffi.VarArgs<(ffi.Pointer,)>)>>( + "globalEnv_CallObjectMethod") + .asFunction< + jni.JniResult Function(ffi.Pointer, jni.JMethodIDPtr, + ffi.Pointer)>(); + + /// from: public okhttp3.Request$Builder url(okhttp3.HttpUrl httpUrl) + /// The returned object must be released after use, by calling the [release] method. + Request_Builder url( + jni.JObject httpUrl, + ) { + return _url(reference.pointer, _id_url as jni.JMethodIDPtr, + httpUrl.reference.pointer) + .object(const $Request_BuilderType()); + } + + static final _id_url1 = _class.instanceMethodId( + r"url", + r"(Ljava/lang/String;)Lokhttp3/Request$Builder;", + ); + + static final _url1 = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + ffi.VarArgs<(ffi.Pointer,)>)>>( + "globalEnv_CallObjectMethod") + .asFunction< + jni.JniResult Function(ffi.Pointer, jni.JMethodIDPtr, + ffi.Pointer)>(); + + /// from: public okhttp3.Request$Builder url(java.lang.String string) + /// The returned object must be released after use, by calling the [release] method. + Request_Builder url1( + jni.JString string, + ) { + return _url1(reference.pointer, _id_url1 as jni.JMethodIDPtr, + string.reference.pointer) + .object(const $Request_BuilderType()); + } + + static final _id_url2 = _class.instanceMethodId( + r"url", + r"(Ljava/net/URL;)Lokhttp3/Request$Builder;", + ); + + static final _url2 = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + ffi.VarArgs<(ffi.Pointer,)>)>>( + "globalEnv_CallObjectMethod") + .asFunction< + jni.JniResult Function(ffi.Pointer, jni.JMethodIDPtr, + ffi.Pointer)>(); + + /// from: public okhttp3.Request$Builder url(java.net.URL uRL) + /// The returned object must be released after use, by calling the [release] method. + Request_Builder url2( + jni.JObject uRL, + ) { + return _url2(reference.pointer, _id_url2 as jni.JMethodIDPtr, + uRL.reference.pointer) + .object(const $Request_BuilderType()); + } + + static final _id_header = _class.instanceMethodId( + r"header", + r"(Ljava/lang/String;Ljava/lang/String;)Lokhttp3/Request$Builder;", + ); + + static final _header = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + ffi.VarArgs< + ( + ffi.Pointer, + ffi.Pointer + )>)>>("globalEnv_CallObjectMethod") + .asFunction< + jni.JniResult Function(ffi.Pointer, jni.JMethodIDPtr, + ffi.Pointer, ffi.Pointer)>(); + + /// from: public okhttp3.Request$Builder header(java.lang.String string, java.lang.String string1) + /// The returned object must be released after use, by calling the [release] method. + Request_Builder header( + jni.JString string, + jni.JString string1, + ) { + return _header(reference.pointer, _id_header as jni.JMethodIDPtr, + string.reference.pointer, string1.reference.pointer) + .object(const $Request_BuilderType()); + } + + static final _id_addHeader = _class.instanceMethodId( + r"addHeader", + r"(Ljava/lang/String;Ljava/lang/String;)Lokhttp3/Request$Builder;", + ); + + static final _addHeader = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + ffi.VarArgs< + ( + ffi.Pointer, + ffi.Pointer + )>)>>("globalEnv_CallObjectMethod") + .asFunction< + jni.JniResult Function(ffi.Pointer, jni.JMethodIDPtr, + ffi.Pointer, ffi.Pointer)>(); + + /// from: public okhttp3.Request$Builder addHeader(java.lang.String string, java.lang.String string1) + /// The returned object must be released after use, by calling the [release] method. + Request_Builder addHeader( + jni.JString string, + jni.JString string1, + ) { + return _addHeader(reference.pointer, _id_addHeader as jni.JMethodIDPtr, + string.reference.pointer, string1.reference.pointer) + .object(const $Request_BuilderType()); + } + + static final _id_removeHeader = _class.instanceMethodId( + r"removeHeader", + r"(Ljava/lang/String;)Lokhttp3/Request$Builder;", + ); + + static final _removeHeader = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + ffi.VarArgs<(ffi.Pointer,)>)>>( + "globalEnv_CallObjectMethod") + .asFunction< + jni.JniResult Function(ffi.Pointer, jni.JMethodIDPtr, + ffi.Pointer)>(); + + /// from: public okhttp3.Request$Builder removeHeader(java.lang.String string) + /// The returned object must be released after use, by calling the [release] method. + Request_Builder removeHeader( + jni.JString string, + ) { + return _removeHeader(reference.pointer, + _id_removeHeader as jni.JMethodIDPtr, string.reference.pointer) + .object(const $Request_BuilderType()); + } + + static final _id_headers = _class.instanceMethodId( + r"headers", + r"(Lokhttp3/Headers;)Lokhttp3/Request$Builder;", + ); + + static final _headers = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + ffi.VarArgs<(ffi.Pointer,)>)>>( + "globalEnv_CallObjectMethod") + .asFunction< + jni.JniResult Function(ffi.Pointer, jni.JMethodIDPtr, + ffi.Pointer)>(); + + /// from: public okhttp3.Request$Builder headers(okhttp3.Headers headers) + /// The returned object must be released after use, by calling the [release] method. + Request_Builder headers( + headers_.Headers headers, + ) { + return _headers(reference.pointer, _id_headers as jni.JMethodIDPtr, + headers.reference.pointer) + .object(const $Request_BuilderType()); + } + + static final _id_cacheControl = _class.instanceMethodId( + r"cacheControl", + r"(Lokhttp3/CacheControl;)Lokhttp3/Request$Builder;", + ); + + static final _cacheControl = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + ffi.VarArgs<(ffi.Pointer,)>)>>( + "globalEnv_CallObjectMethod") + .asFunction< + jni.JniResult Function(ffi.Pointer, jni.JMethodIDPtr, + ffi.Pointer)>(); + + /// from: public okhttp3.Request$Builder cacheControl(okhttp3.CacheControl cacheControl) + /// The returned object must be released after use, by calling the [release] method. + Request_Builder cacheControl( + jni.JObject cacheControl, + ) { + return _cacheControl( + reference.pointer, + _id_cacheControl as jni.JMethodIDPtr, + cacheControl.reference.pointer) + .object(const $Request_BuilderType()); + } + + static final _id_get0 = _class.instanceMethodId( + r"get", + r"()Lokhttp3/Request$Builder;", + ); + + static final _get0 = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + )>>("globalEnv_CallObjectMethod") + .asFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + )>(); + + /// from: public okhttp3.Request$Builder get() + /// The returned object must be released after use, by calling the [release] method. + Request_Builder get0() { + return _get0(reference.pointer, _id_get0 as jni.JMethodIDPtr) + .object(const $Request_BuilderType()); + } + + static final _id_head = _class.instanceMethodId( + r"head", + r"()Lokhttp3/Request$Builder;", + ); + + static final _head = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + )>>("globalEnv_CallObjectMethod") + .asFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + )>(); + + /// from: public okhttp3.Request$Builder head() + /// The returned object must be released after use, by calling the [release] method. + Request_Builder head() { + return _head(reference.pointer, _id_head as jni.JMethodIDPtr) + .object(const $Request_BuilderType()); + } + + static final _id_post = _class.instanceMethodId( + r"post", + r"(Lokhttp3/RequestBody;)Lokhttp3/Request$Builder;", + ); + + static final _post = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + ffi.VarArgs<(ffi.Pointer,)>)>>( + "globalEnv_CallObjectMethod") + .asFunction< + jni.JniResult Function(ffi.Pointer, jni.JMethodIDPtr, + ffi.Pointer)>(); + + /// from: public okhttp3.Request$Builder post(okhttp3.RequestBody requestBody) + /// The returned object must be released after use, by calling the [release] method. + Request_Builder post( + requestbody_.RequestBody requestBody, + ) { + return _post(reference.pointer, _id_post as jni.JMethodIDPtr, + requestBody.reference.pointer) + .object(const $Request_BuilderType()); + } + + static final _id_delete = _class.instanceMethodId( + r"delete", + r"(Lokhttp3/RequestBody;)Lokhttp3/Request$Builder;", + ); + + static final _delete = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + ffi.VarArgs<(ffi.Pointer,)>)>>( + "globalEnv_CallObjectMethod") + .asFunction< + jni.JniResult Function(ffi.Pointer, jni.JMethodIDPtr, + ffi.Pointer)>(); + + /// from: public okhttp3.Request$Builder delete(okhttp3.RequestBody requestBody) + /// The returned object must be released after use, by calling the [release] method. + Request_Builder delete( + requestbody_.RequestBody requestBody, + ) { + return _delete(reference.pointer, _id_delete as jni.JMethodIDPtr, + requestBody.reference.pointer) + .object(const $Request_BuilderType()); + } + + static final _id_put = _class.instanceMethodId( + r"put", + r"(Lokhttp3/RequestBody;)Lokhttp3/Request$Builder;", + ); + + static final _put = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + ffi.VarArgs<(ffi.Pointer,)>)>>( + "globalEnv_CallObjectMethod") + .asFunction< + jni.JniResult Function(ffi.Pointer, jni.JMethodIDPtr, + ffi.Pointer)>(); + + /// from: public okhttp3.Request$Builder put(okhttp3.RequestBody requestBody) + /// The returned object must be released after use, by calling the [release] method. + Request_Builder put( + requestbody_.RequestBody requestBody, + ) { + return _put(reference.pointer, _id_put as jni.JMethodIDPtr, + requestBody.reference.pointer) + .object(const $Request_BuilderType()); + } + + static final _id_patch = _class.instanceMethodId( + r"patch", + r"(Lokhttp3/RequestBody;)Lokhttp3/Request$Builder;", + ); + + static final _patch = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + ffi.VarArgs<(ffi.Pointer,)>)>>( + "globalEnv_CallObjectMethod") + .asFunction< + jni.JniResult Function(ffi.Pointer, jni.JMethodIDPtr, + ffi.Pointer)>(); + + /// from: public okhttp3.Request$Builder patch(okhttp3.RequestBody requestBody) + /// The returned object must be released after use, by calling the [release] method. + Request_Builder patch( + requestbody_.RequestBody requestBody, + ) { + return _patch(reference.pointer, _id_patch as jni.JMethodIDPtr, + requestBody.reference.pointer) + .object(const $Request_BuilderType()); + } + + static final _id_method = _class.instanceMethodId( + r"method", + r"(Ljava/lang/String;Lokhttp3/RequestBody;)Lokhttp3/Request$Builder;", + ); + + static final _method = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + ffi.VarArgs< + ( + ffi.Pointer, + ffi.Pointer + )>)>>("globalEnv_CallObjectMethod") + .asFunction< + jni.JniResult Function(ffi.Pointer, jni.JMethodIDPtr, + ffi.Pointer, ffi.Pointer)>(); + + /// from: public okhttp3.Request$Builder method(java.lang.String string, okhttp3.RequestBody requestBody) + /// The returned object must be released after use, by calling the [release] method. + Request_Builder method( + jni.JString string, + requestbody_.RequestBody requestBody, + ) { + return _method(reference.pointer, _id_method as jni.JMethodIDPtr, + string.reference.pointer, requestBody.reference.pointer) + .object(const $Request_BuilderType()); + } + + static final _id_tag = _class.instanceMethodId( + r"tag", + r"(Ljava/lang/Object;)Lokhttp3/Request$Builder;", + ); + + static final _tag = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + ffi.VarArgs<(ffi.Pointer,)>)>>( + "globalEnv_CallObjectMethod") + .asFunction< + jni.JniResult Function(ffi.Pointer, jni.JMethodIDPtr, + ffi.Pointer)>(); + + /// from: public okhttp3.Request$Builder tag(java.lang.Object object) + /// The returned object must be released after use, by calling the [release] method. + Request_Builder tag( + jni.JObject object, + ) { + return _tag(reference.pointer, _id_tag as jni.JMethodIDPtr, + object.reference.pointer) + .object(const $Request_BuilderType()); + } + + static final _id_tag1 = _class.instanceMethodId( + r"tag", + r"(Ljava/lang/Class;Ljava/lang/Object;)Lokhttp3/Request$Builder;", + ); + + static final _tag1 = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + ffi.VarArgs< + ( + ffi.Pointer, + ffi.Pointer + )>)>>("globalEnv_CallObjectMethod") + .asFunction< + jni.JniResult Function(ffi.Pointer, jni.JMethodIDPtr, + ffi.Pointer, ffi.Pointer)>(); + + /// from: public okhttp3.Request$Builder tag(java.lang.Class class, T object) + /// The returned object must be released after use, by calling the [release] method. + Request_Builder tag1<$T extends jni.JObject>( + jni.JObject class0, + $T object, { + jni.JObjType<$T>? T, + }) { + T ??= jni.lowestCommonSuperType([ + object.$type, + ]) as jni.JObjType<$T>; + return _tag1(reference.pointer, _id_tag1 as jni.JMethodIDPtr, + class0.reference.pointer, object.reference.pointer) + .object(const $Request_BuilderType()); + } + + static final _id_build = _class.instanceMethodId( + r"build", + r"()Lokhttp3/Request;", + ); + + static final _build = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + )>>("globalEnv_CallObjectMethod") + .asFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + )>(); + + /// from: public okhttp3.Request build() + /// The returned object must be released after use, by calling the [release] method. + Request build() { + return _build(reference.pointer, _id_build as jni.JMethodIDPtr) + .object(const $RequestType()); + } + + static final _id_delete1 = _class.instanceMethodId( + r"delete", + r"()Lokhttp3/Request$Builder;", + ); + + static final _delete1 = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + )>>("globalEnv_CallObjectMethod") + .asFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + )>(); + + /// from: public final okhttp3.Request$Builder delete() + /// The returned object must be released after use, by calling the [release] method. + Request_Builder delete1() { + return _delete1(reference.pointer, _id_delete1 as jni.JMethodIDPtr) + .object(const $Request_BuilderType()); + } +} + +final class $Request_BuilderType extends jni.JObjType { + const $Request_BuilderType(); + + @override + String get signature => r"Lokhttp3/Request$Builder;"; + + @override + Request_Builder fromReference(jni.JReference reference) => + Request_Builder.fromReference(reference); + + @override + jni.JObjType get superType => const jni.JObjectType(); + + @override + final superCount = 1; + + @override + int get hashCode => ($Request_BuilderType).hashCode; + + @override + bool operator ==(Object other) { + return other.runtimeType == ($Request_BuilderType) && + other is $Request_BuilderType; + } +} + +/// from: okhttp3.Request +class Request extends jni.JObject { + @override + late final jni.JObjType $type = type; + + Request.fromReference( + jni.JReference reference, + ) : super.fromReference(reference); + + static final _class = jni.JClass.forName(r"okhttp3/Request"); + + /// The type which includes information such as the signature of this class. + static const type = $RequestType(); + static final _id_new0 = _class.constructorId( + r"(Lokhttp3/HttpUrl;Ljava/lang/String;Lokhttp3/Headers;Lokhttp3/RequestBody;Ljava/util/Map;)V", + ); + + static final _new0 = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + ffi.VarArgs< + ( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer + )>)>>("globalEnv_NewObject") + .asFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)>(); + + /// from: public void (okhttp3.HttpUrl httpUrl, java.lang.String string, okhttp3.Headers headers, okhttp3.RequestBody requestBody, java.util.Map map) + /// The returned object must be released after use, by calling the [release] method. + factory Request( + jni.JObject httpUrl, + jni.JString string, + headers_.Headers headers, + requestbody_.RequestBody requestBody, + jni.JMap map, + ) { + return Request.fromReference(_new0( + _class.reference.pointer, + _id_new0 as jni.JMethodIDPtr, + httpUrl.reference.pointer, + string.reference.pointer, + headers.reference.pointer, + requestBody.reference.pointer, + map.reference.pointer) + .reference); + } + + static final _id_url = _class.instanceMethodId( + r"url", + r"()Lokhttp3/HttpUrl;", + ); + + static final _url = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + )>>("globalEnv_CallObjectMethod") + .asFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + )>(); + + /// from: public final okhttp3.HttpUrl url() + /// The returned object must be released after use, by calling the [release] method. + jni.JObject url() { + return _url(reference.pointer, _id_url as jni.JMethodIDPtr) + .object(const jni.JObjectType()); + } + + static final _id_method = _class.instanceMethodId( + r"method", + r"()Ljava/lang/String;", + ); + + static final _method = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + )>>("globalEnv_CallObjectMethod") + .asFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + )>(); + + /// from: public final java.lang.String method() + /// The returned object must be released after use, by calling the [release] method. + jni.JString method() { + return _method(reference.pointer, _id_method as jni.JMethodIDPtr) + .object(const jni.JStringType()); + } + + static final _id_headers = _class.instanceMethodId( + r"headers", + r"()Lokhttp3/Headers;", + ); + + static final _headers = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + )>>("globalEnv_CallObjectMethod") + .asFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + )>(); + + /// from: public final okhttp3.Headers headers() + /// The returned object must be released after use, by calling the [release] method. + headers_.Headers headers() { + return _headers(reference.pointer, _id_headers as jni.JMethodIDPtr) + .object(const headers_.$HeadersType()); + } + + static final _id_body = _class.instanceMethodId( + r"body", + r"()Lokhttp3/RequestBody;", + ); + + static final _body = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + )>>("globalEnv_CallObjectMethod") + .asFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + )>(); + + /// from: public final okhttp3.RequestBody body() + /// The returned object must be released after use, by calling the [release] method. + requestbody_.RequestBody body() { + return _body(reference.pointer, _id_body as jni.JMethodIDPtr) + .object(const requestbody_.$RequestBodyType()); + } + + static final _id_isHttps = _class.instanceMethodId( + r"isHttps", + r"()Z", + ); + + static final _isHttps = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + )>>("globalEnv_CallBooleanMethod") + .asFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + )>(); + + /// from: public final boolean isHttps() + bool isHttps() { + return _isHttps(reference.pointer, _id_isHttps as jni.JMethodIDPtr).boolean; + } + + static final _id_header = _class.instanceMethodId( + r"header", + r"(Ljava/lang/String;)Ljava/lang/String;", + ); + + static final _header = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + ffi.VarArgs<(ffi.Pointer,)>)>>( + "globalEnv_CallObjectMethod") + .asFunction< + jni.JniResult Function(ffi.Pointer, jni.JMethodIDPtr, + ffi.Pointer)>(); + + /// from: public final java.lang.String header(java.lang.String string) + /// The returned object must be released after use, by calling the [release] method. + jni.JString header( + jni.JString string, + ) { + return _header(reference.pointer, _id_header as jni.JMethodIDPtr, + string.reference.pointer) + .object(const jni.JStringType()); + } + + static final _id_headers1 = _class.instanceMethodId( + r"headers", + r"(Ljava/lang/String;)Ljava/util/List;", + ); + + static final _headers1 = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + ffi.VarArgs<(ffi.Pointer,)>)>>( + "globalEnv_CallObjectMethod") + .asFunction< + jni.JniResult Function(ffi.Pointer, jni.JMethodIDPtr, + ffi.Pointer)>(); + + /// from: public final java.util.List headers(java.lang.String string) + /// The returned object must be released after use, by calling the [release] method. + jni.JList headers1( + jni.JString string, + ) { + return _headers1(reference.pointer, _id_headers1 as jni.JMethodIDPtr, + string.reference.pointer) + .object(const jni.JListType(jni.JStringType())); + } + + static final _id_tag = _class.instanceMethodId( + r"tag", + r"()Ljava/lang/Object;", + ); + + static final _tag = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + )>>("globalEnv_CallObjectMethod") + .asFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + )>(); + + /// from: public final java.lang.Object tag() + /// The returned object must be released after use, by calling the [release] method. + jni.JObject tag() { + return _tag(reference.pointer, _id_tag as jni.JMethodIDPtr) + .object(const jni.JObjectType()); + } + + static final _id_tag1 = _class.instanceMethodId( + r"tag", + r"(Ljava/lang/Class;)Ljava/lang/Object;", + ); + + static final _tag1 = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + ffi.VarArgs<(ffi.Pointer,)>)>>( + "globalEnv_CallObjectMethod") + .asFunction< + jni.JniResult Function(ffi.Pointer, jni.JMethodIDPtr, + ffi.Pointer)>(); + + /// from: public final T tag(java.lang.Class class) + /// The returned object must be released after use, by calling the [release] method. + $T tag1<$T extends jni.JObject>( + jni.JObject class0, { + required jni.JObjType<$T> T, + }) { + return _tag1(reference.pointer, _id_tag1 as jni.JMethodIDPtr, + class0.reference.pointer) + .object(T); + } + + static final _id_newBuilder = _class.instanceMethodId( + r"newBuilder", + r"()Lokhttp3/Request$Builder;", + ); + + static final _newBuilder = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + )>>("globalEnv_CallObjectMethod") + .asFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + )>(); + + /// from: public final okhttp3.Request$Builder newBuilder() + /// The returned object must be released after use, by calling the [release] method. + Request_Builder newBuilder() { + return _newBuilder(reference.pointer, _id_newBuilder as jni.JMethodIDPtr) + .object(const $Request_BuilderType()); + } + + static final _id_cacheControl = _class.instanceMethodId( + r"cacheControl", + r"()Lokhttp3/CacheControl;", + ); + + static final _cacheControl = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + )>>("globalEnv_CallObjectMethod") + .asFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + )>(); + + /// from: public final okhttp3.CacheControl cacheControl() + /// The returned object must be released after use, by calling the [release] method. + jni.JObject cacheControl() { + return _cacheControl( + reference.pointer, _id_cacheControl as jni.JMethodIDPtr) + .object(const jni.JObjectType()); + } + + static final _id_toString1 = _class.instanceMethodId( + r"toString", + r"()Ljava/lang/String;", + ); + + static final _toString1 = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + )>>("globalEnv_CallObjectMethod") + .asFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + )>(); + + /// from: public java.lang.String toString() + /// The returned object must be released after use, by calling the [release] method. + jni.JString toString1() { + return _toString1(reference.pointer, _id_toString1 as jni.JMethodIDPtr) + .object(const jni.JStringType()); + } +} + +final class $RequestType extends jni.JObjType { + const $RequestType(); + + @override + String get signature => r"Lokhttp3/Request;"; + + @override + Request fromReference(jni.JReference reference) => + Request.fromReference(reference); + + @override + jni.JObjType get superType => const jni.JObjectType(); + + @override + final superCount = 1; + + @override + int get hashCode => ($RequestType).hashCode; + + @override + bool operator ==(Object other) { + return other.runtimeType == ($RequestType) && other is $RequestType; + } +} diff --git a/pkgs/ok_http/lib/src/third_party/okhttp3/RequestBody.dart b/pkgs/ok_http/lib/src/third_party/okhttp3/RequestBody.dart new file mode 100644 index 0000000000..53108d95b8 --- /dev/null +++ b/pkgs/ok_http/lib/src/third_party/okhttp3/RequestBody.dart @@ -0,0 +1,1080 @@ +// Autogenerated by jnigen. DO NOT EDIT! + +// ignore_for_file: annotate_overrides +// ignore_for_file: camel_case_extensions +// ignore_for_file: camel_case_types +// ignore_for_file: constant_identifier_names +// ignore_for_file: doc_directive_unknown +// ignore_for_file: file_names +// ignore_for_file: lines_longer_than_80_chars +// ignore_for_file: no_leading_underscores_for_local_identifiers +// ignore_for_file: non_constant_identifier_names +// ignore_for_file: overridden_fields +// ignore_for_file: unnecessary_cast +// ignore_for_file: unused_element +// ignore_for_file: unused_field +// ignore_for_file: unused_import +// ignore_for_file: unused_local_variable +// ignore_for_file: unused_shown_name +// ignore_for_file: use_super_parameters + +import "dart:isolate" show ReceivePort; +import "dart:ffi" as ffi; +import "package:jni/internal_helpers_for_jnigen.dart"; +import "package:jni/jni.dart" as jni; + +/// from: okhttp3.RequestBody$Companion +class RequestBody_Companion extends jni.JObject { + @override + late final jni.JObjType $type = type; + + RequestBody_Companion.fromReference( + jni.JReference reference, + ) : super.fromReference(reference); + + static final _class = jni.JClass.forName(r"okhttp3/RequestBody$Companion"); + + /// The type which includes information such as the signature of this class. + static const type = $RequestBody_CompanionType(); + static final _id_create = _class.instanceMethodId( + r"create", + r"(Ljava/lang/String;Lokhttp3/MediaType;)Lokhttp3/RequestBody;", + ); + + static final _create = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + ffi.VarArgs< + ( + ffi.Pointer, + ffi.Pointer + )>)>>("globalEnv_CallObjectMethod") + .asFunction< + jni.JniResult Function(ffi.Pointer, jni.JMethodIDPtr, + ffi.Pointer, ffi.Pointer)>(); + + /// from: public final okhttp3.RequestBody create(java.lang.String string, okhttp3.MediaType mediaType) + /// The returned object must be released after use, by calling the [release] method. + RequestBody create( + jni.JString string, + jni.JObject mediaType, + ) { + return _create(reference.pointer, _id_create as jni.JMethodIDPtr, + string.reference.pointer, mediaType.reference.pointer) + .object(const $RequestBodyType()); + } + + static final _id_create1 = _class.instanceMethodId( + r"create", + r"(Lokio/ByteString;Lokhttp3/MediaType;)Lokhttp3/RequestBody;", + ); + + static final _create1 = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + ffi.VarArgs< + ( + ffi.Pointer, + ffi.Pointer + )>)>>("globalEnv_CallObjectMethod") + .asFunction< + jni.JniResult Function(ffi.Pointer, jni.JMethodIDPtr, + ffi.Pointer, ffi.Pointer)>(); + + /// from: public final okhttp3.RequestBody create(okio.ByteString byteString, okhttp3.MediaType mediaType) + /// The returned object must be released after use, by calling the [release] method. + RequestBody create1( + jni.JObject byteString, + jni.JObject mediaType, + ) { + return _create1(reference.pointer, _id_create1 as jni.JMethodIDPtr, + byteString.reference.pointer, mediaType.reference.pointer) + .object(const $RequestBodyType()); + } + + static final _id_create2 = _class.instanceMethodId( + r"create", + r"([BLokhttp3/MediaType;II)Lokhttp3/RequestBody;", + ); + + static final _create2 = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + ffi.VarArgs< + ( + ffi.Pointer, + ffi.Pointer, + ffi.Int64, + ffi.Int64 + )>)>>("globalEnv_CallObjectMethod") + .asFunction< + jni.JniResult Function(ffi.Pointer, jni.JMethodIDPtr, + ffi.Pointer, ffi.Pointer, int, int)>(); + + /// from: public final okhttp3.RequestBody create(byte[] bs, okhttp3.MediaType mediaType, int i, int i1) + /// The returned object must be released after use, by calling the [release] method. + RequestBody create2( + jni.JArray bs, + jni.JObject mediaType, + int i, + int i1, + ) { + return _create2(reference.pointer, _id_create2 as jni.JMethodIDPtr, + bs.reference.pointer, mediaType.reference.pointer, i, i1) + .object(const $RequestBodyType()); + } + + static final _id_create3 = _class.instanceMethodId( + r"create", + r"(Ljava/io/File;Lokhttp3/MediaType;)Lokhttp3/RequestBody;", + ); + + static final _create3 = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + ffi.VarArgs< + ( + ffi.Pointer, + ffi.Pointer + )>)>>("globalEnv_CallObjectMethod") + .asFunction< + jni.JniResult Function(ffi.Pointer, jni.JMethodIDPtr, + ffi.Pointer, ffi.Pointer)>(); + + /// from: public final okhttp3.RequestBody create(java.io.File file, okhttp3.MediaType mediaType) + /// The returned object must be released after use, by calling the [release] method. + RequestBody create3( + jni.JObject file, + jni.JObject mediaType, + ) { + return _create3(reference.pointer, _id_create3 as jni.JMethodIDPtr, + file.reference.pointer, mediaType.reference.pointer) + .object(const $RequestBodyType()); + } + + static final _id_create4 = _class.instanceMethodId( + r"create", + r"(Lokhttp3/MediaType;Ljava/lang/String;)Lokhttp3/RequestBody;", + ); + + static final _create4 = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + ffi.VarArgs< + ( + ffi.Pointer, + ffi.Pointer + )>)>>("globalEnv_CallObjectMethod") + .asFunction< + jni.JniResult Function(ffi.Pointer, jni.JMethodIDPtr, + ffi.Pointer, ffi.Pointer)>(); + + /// from: public final okhttp3.RequestBody create(okhttp3.MediaType mediaType, java.lang.String string) + /// The returned object must be released after use, by calling the [release] method. + RequestBody create4( + jni.JObject mediaType, + jni.JString string, + ) { + return _create4(reference.pointer, _id_create4 as jni.JMethodIDPtr, + mediaType.reference.pointer, string.reference.pointer) + .object(const $RequestBodyType()); + } + + static final _id_create5 = _class.instanceMethodId( + r"create", + r"(Lokhttp3/MediaType;Lokio/ByteString;)Lokhttp3/RequestBody;", + ); + + static final _create5 = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + ffi.VarArgs< + ( + ffi.Pointer, + ffi.Pointer + )>)>>("globalEnv_CallObjectMethod") + .asFunction< + jni.JniResult Function(ffi.Pointer, jni.JMethodIDPtr, + ffi.Pointer, ffi.Pointer)>(); + + /// from: public final okhttp3.RequestBody create(okhttp3.MediaType mediaType, okio.ByteString byteString) + /// The returned object must be released after use, by calling the [release] method. + RequestBody create5( + jni.JObject mediaType, + jni.JObject byteString, + ) { + return _create5(reference.pointer, _id_create5 as jni.JMethodIDPtr, + mediaType.reference.pointer, byteString.reference.pointer) + .object(const $RequestBodyType()); + } + + static final _id_create6 = _class.instanceMethodId( + r"create", + r"(Lokhttp3/MediaType;[BII)Lokhttp3/RequestBody;", + ); + + static final _create6 = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + ffi.VarArgs< + ( + ffi.Pointer, + ffi.Pointer, + ffi.Int64, + ffi.Int64 + )>)>>("globalEnv_CallObjectMethod") + .asFunction< + jni.JniResult Function(ffi.Pointer, jni.JMethodIDPtr, + ffi.Pointer, ffi.Pointer, int, int)>(); + + /// from: public final okhttp3.RequestBody create(okhttp3.MediaType mediaType, byte[] bs, int i, int i1) + /// The returned object must be released after use, by calling the [release] method. + RequestBody create6( + jni.JObject mediaType, + jni.JArray bs, + int i, + int i1, + ) { + return _create6(reference.pointer, _id_create6 as jni.JMethodIDPtr, + mediaType.reference.pointer, bs.reference.pointer, i, i1) + .object(const $RequestBodyType()); + } + + static final _id_create7 = _class.instanceMethodId( + r"create", + r"(Lokhttp3/MediaType;Ljava/io/File;)Lokhttp3/RequestBody;", + ); + + static final _create7 = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + ffi.VarArgs< + ( + ffi.Pointer, + ffi.Pointer + )>)>>("globalEnv_CallObjectMethod") + .asFunction< + jni.JniResult Function(ffi.Pointer, jni.JMethodIDPtr, + ffi.Pointer, ffi.Pointer)>(); + + /// from: public final okhttp3.RequestBody create(okhttp3.MediaType mediaType, java.io.File file) + /// The returned object must be released after use, by calling the [release] method. + RequestBody create7( + jni.JObject mediaType, + jni.JObject file, + ) { + return _create7(reference.pointer, _id_create7 as jni.JMethodIDPtr, + mediaType.reference.pointer, file.reference.pointer) + .object(const $RequestBodyType()); + } + + static final _id_create8 = _class.instanceMethodId( + r"create", + r"([BLokhttp3/MediaType;I)Lokhttp3/RequestBody;", + ); + + static final _create8 = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + ffi.VarArgs< + ( + ffi.Pointer, + ffi.Pointer, + ffi.Int64 + )>)>>("globalEnv_CallObjectMethod") + .asFunction< + jni.JniResult Function(ffi.Pointer, jni.JMethodIDPtr, + ffi.Pointer, ffi.Pointer, int)>(); + + /// from: public final okhttp3.RequestBody create(byte[] bs, okhttp3.MediaType mediaType, int i) + /// The returned object must be released after use, by calling the [release] method. + RequestBody create8( + jni.JArray bs, + jni.JObject mediaType, + int i, + ) { + return _create8(reference.pointer, _id_create8 as jni.JMethodIDPtr, + bs.reference.pointer, mediaType.reference.pointer, i) + .object(const $RequestBodyType()); + } + + static final _id_create9 = _class.instanceMethodId( + r"create", + r"([BLokhttp3/MediaType;)Lokhttp3/RequestBody;", + ); + + static final _create9 = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + ffi.VarArgs< + ( + ffi.Pointer, + ffi.Pointer + )>)>>("globalEnv_CallObjectMethod") + .asFunction< + jni.JniResult Function(ffi.Pointer, jni.JMethodIDPtr, + ffi.Pointer, ffi.Pointer)>(); + + /// from: public final okhttp3.RequestBody create(byte[] bs, okhttp3.MediaType mediaType) + /// The returned object must be released after use, by calling the [release] method. + RequestBody create9( + jni.JArray bs, + jni.JObject mediaType, + ) { + return _create9(reference.pointer, _id_create9 as jni.JMethodIDPtr, + bs.reference.pointer, mediaType.reference.pointer) + .object(const $RequestBodyType()); + } + + static final _id_create10 = _class.instanceMethodId( + r"create", + r"([B)Lokhttp3/RequestBody;", + ); + + static final _create10 = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + ffi.VarArgs<(ffi.Pointer,)>)>>( + "globalEnv_CallObjectMethod") + .asFunction< + jni.JniResult Function(ffi.Pointer, jni.JMethodIDPtr, + ffi.Pointer)>(); + + /// from: public final okhttp3.RequestBody create(byte[] bs) + /// The returned object must be released after use, by calling the [release] method. + RequestBody create10( + jni.JArray bs, + ) { + return _create10(reference.pointer, _id_create10 as jni.JMethodIDPtr, + bs.reference.pointer) + .object(const $RequestBodyType()); + } + + static final _id_create11 = _class.instanceMethodId( + r"create", + r"(Lokhttp3/MediaType;[BI)Lokhttp3/RequestBody;", + ); + + static final _create11 = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + ffi.VarArgs< + ( + ffi.Pointer, + ffi.Pointer, + ffi.Int64 + )>)>>("globalEnv_CallObjectMethod") + .asFunction< + jni.JniResult Function(ffi.Pointer, jni.JMethodIDPtr, + ffi.Pointer, ffi.Pointer, int)>(); + + /// from: public final okhttp3.RequestBody create(okhttp3.MediaType mediaType, byte[] bs, int i) + /// The returned object must be released after use, by calling the [release] method. + RequestBody create11( + jni.JObject mediaType, + jni.JArray bs, + int i, + ) { + return _create11(reference.pointer, _id_create11 as jni.JMethodIDPtr, + mediaType.reference.pointer, bs.reference.pointer, i) + .object(const $RequestBodyType()); + } + + static final _id_create12 = _class.instanceMethodId( + r"create", + r"(Lokhttp3/MediaType;[B)Lokhttp3/RequestBody;", + ); + + static final _create12 = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + ffi.VarArgs< + ( + ffi.Pointer, + ffi.Pointer + )>)>>("globalEnv_CallObjectMethod") + .asFunction< + jni.JniResult Function(ffi.Pointer, jni.JMethodIDPtr, + ffi.Pointer, ffi.Pointer)>(); + + /// from: public final okhttp3.RequestBody create(okhttp3.MediaType mediaType, byte[] bs) + /// The returned object must be released after use, by calling the [release] method. + RequestBody create12( + jni.JObject mediaType, + jni.JArray bs, + ) { + return _create12(reference.pointer, _id_create12 as jni.JMethodIDPtr, + mediaType.reference.pointer, bs.reference.pointer) + .object(const $RequestBodyType()); + } + + static final _id_new0 = _class.constructorId( + r"(Lkotlin/jvm/internal/DefaultConstructorMarker;)V", + ); + + static final _new0 = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + ffi.VarArgs<(ffi.Pointer,)>)>>( + "globalEnv_NewObject") + .asFunction< + jni.JniResult Function(ffi.Pointer, jni.JMethodIDPtr, + ffi.Pointer)>(); + + /// from: public void (kotlin.jvm.internal.DefaultConstructorMarker defaultConstructorMarker) + /// The returned object must be released after use, by calling the [release] method. + factory RequestBody_Companion( + jni.JObject defaultConstructorMarker, + ) { + return RequestBody_Companion.fromReference(_new0( + _class.reference.pointer, + _id_new0 as jni.JMethodIDPtr, + defaultConstructorMarker.reference.pointer) + .reference); + } +} + +final class $RequestBody_CompanionType + extends jni.JObjType { + const $RequestBody_CompanionType(); + + @override + String get signature => r"Lokhttp3/RequestBody$Companion;"; + + @override + RequestBody_Companion fromReference(jni.JReference reference) => + RequestBody_Companion.fromReference(reference); + + @override + jni.JObjType get superType => const jni.JObjectType(); + + @override + final superCount = 1; + + @override + int get hashCode => ($RequestBody_CompanionType).hashCode; + + @override + bool operator ==(Object other) { + return other.runtimeType == ($RequestBody_CompanionType) && + other is $RequestBody_CompanionType; + } +} + +/// from: okhttp3.RequestBody +class RequestBody extends jni.JObject { + @override + late final jni.JObjType $type = type; + + RequestBody.fromReference( + jni.JReference reference, + ) : super.fromReference(reference); + + static final _class = jni.JClass.forName(r"okhttp3/RequestBody"); + + /// The type which includes information such as the signature of this class. + static const type = $RequestBodyType(); + static final _id_Companion = _class.staticFieldId( + r"Companion", + r"Lokhttp3/RequestBody$Companion;", + ); + + /// from: static public final okhttp3.RequestBody$Companion Companion + /// The returned object must be released after use, by calling the [release] method. + static RequestBody_Companion get Companion => + _id_Companion.get(_class, const $RequestBody_CompanionType()); + + static final _id_new0 = _class.constructorId( + r"()V", + ); + + static final _new0 = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + )>>("globalEnv_NewObject") + .asFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + )>(); + + /// from: public void () + /// The returned object must be released after use, by calling the [release] method. + factory RequestBody() { + return RequestBody.fromReference( + _new0(_class.reference.pointer, _id_new0 as jni.JMethodIDPtr) + .reference); + } + + static final _id_contentType = _class.instanceMethodId( + r"contentType", + r"()Lokhttp3/MediaType;", + ); + + static final _contentType = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + )>>("globalEnv_CallObjectMethod") + .asFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + )>(); + + /// from: public abstract okhttp3.MediaType contentType() + /// The returned object must be released after use, by calling the [release] method. + jni.JObject contentType() { + return _contentType(reference.pointer, _id_contentType as jni.JMethodIDPtr) + .object(const jni.JObjectType()); + } + + static final _id_contentLength = _class.instanceMethodId( + r"contentLength", + r"()J", + ); + + static final _contentLength = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + )>>("globalEnv_CallLongMethod") + .asFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + )>(); + + /// from: public long contentLength() + int contentLength() { + return _contentLength( + reference.pointer, _id_contentLength as jni.JMethodIDPtr) + .long; + } + + static final _id_writeTo = _class.instanceMethodId( + r"writeTo", + r"(Lokio/BufferedSink;)V", + ); + + static final _writeTo = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JThrowablePtr Function( + ffi.Pointer, + jni.JMethodIDPtr, + ffi.VarArgs<(ffi.Pointer,)>)>>( + "globalEnv_CallVoidMethod") + .asFunction< + jni.JThrowablePtr Function(ffi.Pointer, jni.JMethodIDPtr, + ffi.Pointer)>(); + + /// from: public abstract void writeTo(okio.BufferedSink bufferedSink) + void writeTo( + jni.JObject bufferedSink, + ) { + _writeTo(reference.pointer, _id_writeTo as jni.JMethodIDPtr, + bufferedSink.reference.pointer) + .check(); + } + + static final _id_isDuplex = _class.instanceMethodId( + r"isDuplex", + r"()Z", + ); + + static final _isDuplex = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + )>>("globalEnv_CallBooleanMethod") + .asFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + )>(); + + /// from: public boolean isDuplex() + bool isDuplex() { + return _isDuplex(reference.pointer, _id_isDuplex as jni.JMethodIDPtr) + .boolean; + } + + static final _id_isOneShot = _class.instanceMethodId( + r"isOneShot", + r"()Z", + ); + + static final _isOneShot = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + )>>("globalEnv_CallBooleanMethod") + .asFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + )>(); + + /// from: public boolean isOneShot() + bool isOneShot() { + return _isOneShot(reference.pointer, _id_isOneShot as jni.JMethodIDPtr) + .boolean; + } + + static final _id_create = _class.staticMethodId( + r"create", + r"(Ljava/lang/String;Lokhttp3/MediaType;)Lokhttp3/RequestBody;", + ); + + static final _create = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + ffi.VarArgs< + ( + ffi.Pointer, + ffi.Pointer + )>)>>("globalEnv_CallStaticObjectMethod") + .asFunction< + jni.JniResult Function(ffi.Pointer, jni.JMethodIDPtr, + ffi.Pointer, ffi.Pointer)>(); + + /// from: static public final okhttp3.RequestBody create(java.lang.String string, okhttp3.MediaType mediaType) + /// The returned object must be released after use, by calling the [release] method. + static RequestBody create( + jni.JString string, + jni.JObject mediaType, + ) { + return _create(_class.reference.pointer, _id_create as jni.JMethodIDPtr, + string.reference.pointer, mediaType.reference.pointer) + .object(const $RequestBodyType()); + } + + static final _id_create1 = _class.staticMethodId( + r"create", + r"(Lokio/ByteString;Lokhttp3/MediaType;)Lokhttp3/RequestBody;", + ); + + static final _create1 = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + ffi.VarArgs< + ( + ffi.Pointer, + ffi.Pointer + )>)>>("globalEnv_CallStaticObjectMethod") + .asFunction< + jni.JniResult Function(ffi.Pointer, jni.JMethodIDPtr, + ffi.Pointer, ffi.Pointer)>(); + + /// from: static public final okhttp3.RequestBody create(okio.ByteString byteString, okhttp3.MediaType mediaType) + /// The returned object must be released after use, by calling the [release] method. + static RequestBody create1( + jni.JObject byteString, + jni.JObject mediaType, + ) { + return _create1(_class.reference.pointer, _id_create1 as jni.JMethodIDPtr, + byteString.reference.pointer, mediaType.reference.pointer) + .object(const $RequestBodyType()); + } + + static final _id_create2 = _class.staticMethodId( + r"create", + r"([BLokhttp3/MediaType;II)Lokhttp3/RequestBody;", + ); + + static final _create2 = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + ffi.VarArgs< + ( + ffi.Pointer, + ffi.Pointer, + ffi.Int64, + ffi.Int64 + )>)>>("globalEnv_CallStaticObjectMethod") + .asFunction< + jni.JniResult Function(ffi.Pointer, jni.JMethodIDPtr, + ffi.Pointer, ffi.Pointer, int, int)>(); + + /// from: static public final okhttp3.RequestBody create(byte[] bs, okhttp3.MediaType mediaType, int i, int i1) + /// The returned object must be released after use, by calling the [release] method. + static RequestBody create2( + jni.JArray bs, + jni.JObject mediaType, + int i, + int i1, + ) { + return _create2(_class.reference.pointer, _id_create2 as jni.JMethodIDPtr, + bs.reference.pointer, mediaType.reference.pointer, i, i1) + .object(const $RequestBodyType()); + } + + static final _id_create3 = _class.staticMethodId( + r"create", + r"(Ljava/io/File;Lokhttp3/MediaType;)Lokhttp3/RequestBody;", + ); + + static final _create3 = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + ffi.VarArgs< + ( + ffi.Pointer, + ffi.Pointer + )>)>>("globalEnv_CallStaticObjectMethod") + .asFunction< + jni.JniResult Function(ffi.Pointer, jni.JMethodIDPtr, + ffi.Pointer, ffi.Pointer)>(); + + /// from: static public final okhttp3.RequestBody create(java.io.File file, okhttp3.MediaType mediaType) + /// The returned object must be released after use, by calling the [release] method. + static RequestBody create3( + jni.JObject file, + jni.JObject mediaType, + ) { + return _create3(_class.reference.pointer, _id_create3 as jni.JMethodIDPtr, + file.reference.pointer, mediaType.reference.pointer) + .object(const $RequestBodyType()); + } + + static final _id_create4 = _class.staticMethodId( + r"create", + r"(Lokhttp3/MediaType;Ljava/lang/String;)Lokhttp3/RequestBody;", + ); + + static final _create4 = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + ffi.VarArgs< + ( + ffi.Pointer, + ffi.Pointer + )>)>>("globalEnv_CallStaticObjectMethod") + .asFunction< + jni.JniResult Function(ffi.Pointer, jni.JMethodIDPtr, + ffi.Pointer, ffi.Pointer)>(); + + /// from: static public final okhttp3.RequestBody create(okhttp3.MediaType mediaType, java.lang.String string) + /// The returned object must be released after use, by calling the [release] method. + static RequestBody create4( + jni.JObject mediaType, + jni.JString string, + ) { + return _create4(_class.reference.pointer, _id_create4 as jni.JMethodIDPtr, + mediaType.reference.pointer, string.reference.pointer) + .object(const $RequestBodyType()); + } + + static final _id_create5 = _class.staticMethodId( + r"create", + r"(Lokhttp3/MediaType;Lokio/ByteString;)Lokhttp3/RequestBody;", + ); + + static final _create5 = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + ffi.VarArgs< + ( + ffi.Pointer, + ffi.Pointer + )>)>>("globalEnv_CallStaticObjectMethod") + .asFunction< + jni.JniResult Function(ffi.Pointer, jni.JMethodIDPtr, + ffi.Pointer, ffi.Pointer)>(); + + /// from: static public final okhttp3.RequestBody create(okhttp3.MediaType mediaType, okio.ByteString byteString) + /// The returned object must be released after use, by calling the [release] method. + static RequestBody create5( + jni.JObject mediaType, + jni.JObject byteString, + ) { + return _create5(_class.reference.pointer, _id_create5 as jni.JMethodIDPtr, + mediaType.reference.pointer, byteString.reference.pointer) + .object(const $RequestBodyType()); + } + + static final _id_create6 = _class.staticMethodId( + r"create", + r"(Lokhttp3/MediaType;[BII)Lokhttp3/RequestBody;", + ); + + static final _create6 = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + ffi.VarArgs< + ( + ffi.Pointer, + ffi.Pointer, + ffi.Int64, + ffi.Int64 + )>)>>("globalEnv_CallStaticObjectMethod") + .asFunction< + jni.JniResult Function(ffi.Pointer, jni.JMethodIDPtr, + ffi.Pointer, ffi.Pointer, int, int)>(); + + /// from: static public final okhttp3.RequestBody create(okhttp3.MediaType mediaType, byte[] bs, int i, int i1) + /// The returned object must be released after use, by calling the [release] method. + static RequestBody create6( + jni.JObject mediaType, + jni.JArray bs, + int i, + int i1, + ) { + return _create6(_class.reference.pointer, _id_create6 as jni.JMethodIDPtr, + mediaType.reference.pointer, bs.reference.pointer, i, i1) + .object(const $RequestBodyType()); + } + + static final _id_create7 = _class.staticMethodId( + r"create", + r"(Lokhttp3/MediaType;Ljava/io/File;)Lokhttp3/RequestBody;", + ); + + static final _create7 = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + ffi.VarArgs< + ( + ffi.Pointer, + ffi.Pointer + )>)>>("globalEnv_CallStaticObjectMethod") + .asFunction< + jni.JniResult Function(ffi.Pointer, jni.JMethodIDPtr, + ffi.Pointer, ffi.Pointer)>(); + + /// from: static public final okhttp3.RequestBody create(okhttp3.MediaType mediaType, java.io.File file) + /// The returned object must be released after use, by calling the [release] method. + static RequestBody create7( + jni.JObject mediaType, + jni.JObject file, + ) { + return _create7(_class.reference.pointer, _id_create7 as jni.JMethodIDPtr, + mediaType.reference.pointer, file.reference.pointer) + .object(const $RequestBodyType()); + } + + static final _id_create8 = _class.staticMethodId( + r"create", + r"([BLokhttp3/MediaType;I)Lokhttp3/RequestBody;", + ); + + static final _create8 = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + ffi.VarArgs< + ( + ffi.Pointer, + ffi.Pointer, + ffi.Int64 + )>)>>("globalEnv_CallStaticObjectMethod") + .asFunction< + jni.JniResult Function(ffi.Pointer, jni.JMethodIDPtr, + ffi.Pointer, ffi.Pointer, int)>(); + + /// from: static public final okhttp3.RequestBody create(byte[] bs, okhttp3.MediaType mediaType, int i) + /// The returned object must be released after use, by calling the [release] method. + static RequestBody create8( + jni.JArray bs, + jni.JObject mediaType, + int i, + ) { + return _create8(_class.reference.pointer, _id_create8 as jni.JMethodIDPtr, + bs.reference.pointer, mediaType.reference.pointer, i) + .object(const $RequestBodyType()); + } + + static final _id_create9 = _class.staticMethodId( + r"create", + r"([BLokhttp3/MediaType;)Lokhttp3/RequestBody;", + ); + + static final _create9 = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + ffi.VarArgs< + ( + ffi.Pointer, + ffi.Pointer + )>)>>("globalEnv_CallStaticObjectMethod") + .asFunction< + jni.JniResult Function(ffi.Pointer, jni.JMethodIDPtr, + ffi.Pointer, ffi.Pointer)>(); + + /// from: static public final okhttp3.RequestBody create(byte[] bs, okhttp3.MediaType mediaType) + /// The returned object must be released after use, by calling the [release] method. + static RequestBody create9( + jni.JArray bs, + jni.JObject mediaType, + ) { + return _create9(_class.reference.pointer, _id_create9 as jni.JMethodIDPtr, + bs.reference.pointer, mediaType.reference.pointer) + .object(const $RequestBodyType()); + } + + static final _id_create10 = _class.staticMethodId( + r"create", + r"([B)Lokhttp3/RequestBody;", + ); + + static final _create10 = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + ffi.VarArgs<(ffi.Pointer,)>)>>( + "globalEnv_CallStaticObjectMethod") + .asFunction< + jni.JniResult Function(ffi.Pointer, jni.JMethodIDPtr, + ffi.Pointer)>(); + + /// from: static public final okhttp3.RequestBody create(byte[] bs) + /// The returned object must be released after use, by calling the [release] method. + static RequestBody create10( + jni.JArray bs, + ) { + return _create10(_class.reference.pointer, _id_create10 as jni.JMethodIDPtr, + bs.reference.pointer) + .object(const $RequestBodyType()); + } + + static final _id_create11 = _class.staticMethodId( + r"create", + r"(Lokhttp3/MediaType;[BI)Lokhttp3/RequestBody;", + ); + + static final _create11 = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + ffi.VarArgs< + ( + ffi.Pointer, + ffi.Pointer, + ffi.Int64 + )>)>>("globalEnv_CallStaticObjectMethod") + .asFunction< + jni.JniResult Function(ffi.Pointer, jni.JMethodIDPtr, + ffi.Pointer, ffi.Pointer, int)>(); + + /// from: static public final okhttp3.RequestBody create(okhttp3.MediaType mediaType, byte[] bs, int i) + /// The returned object must be released after use, by calling the [release] method. + static RequestBody create11( + jni.JObject mediaType, + jni.JArray bs, + int i, + ) { + return _create11(_class.reference.pointer, _id_create11 as jni.JMethodIDPtr, + mediaType.reference.pointer, bs.reference.pointer, i) + .object(const $RequestBodyType()); + } + + static final _id_create12 = _class.staticMethodId( + r"create", + r"(Lokhttp3/MediaType;[B)Lokhttp3/RequestBody;", + ); + + static final _create12 = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + ffi.VarArgs< + ( + ffi.Pointer, + ffi.Pointer + )>)>>("globalEnv_CallStaticObjectMethod") + .asFunction< + jni.JniResult Function(ffi.Pointer, jni.JMethodIDPtr, + ffi.Pointer, ffi.Pointer)>(); + + /// from: static public final okhttp3.RequestBody create(okhttp3.MediaType mediaType, byte[] bs) + /// The returned object must be released after use, by calling the [release] method. + static RequestBody create12( + jni.JObject mediaType, + jni.JArray bs, + ) { + return _create12(_class.reference.pointer, _id_create12 as jni.JMethodIDPtr, + mediaType.reference.pointer, bs.reference.pointer) + .object(const $RequestBodyType()); + } +} + +final class $RequestBodyType extends jni.JObjType { + const $RequestBodyType(); + + @override + String get signature => r"Lokhttp3/RequestBody;"; + + @override + RequestBody fromReference(jni.JReference reference) => + RequestBody.fromReference(reference); + + @override + jni.JObjType get superType => const jni.JObjectType(); + + @override + final superCount = 1; + + @override + int get hashCode => ($RequestBodyType).hashCode; + + @override + bool operator ==(Object other) { + return other.runtimeType == ($RequestBodyType) && other is $RequestBodyType; + } +} diff --git a/pkgs/ok_http/lib/src/third_party/okhttp3/Response.dart b/pkgs/ok_http/lib/src/third_party/okhttp3/Response.dart new file mode 100644 index 0000000000..49d50c9549 --- /dev/null +++ b/pkgs/ok_http/lib/src/third_party/okhttp3/Response.dart @@ -0,0 +1,1256 @@ +// Autogenerated by jnigen. DO NOT EDIT! + +// ignore_for_file: annotate_overrides +// ignore_for_file: camel_case_extensions +// ignore_for_file: camel_case_types +// ignore_for_file: constant_identifier_names +// ignore_for_file: doc_directive_unknown +// ignore_for_file: file_names +// ignore_for_file: lines_longer_than_80_chars +// ignore_for_file: no_leading_underscores_for_local_identifiers +// ignore_for_file: non_constant_identifier_names +// ignore_for_file: overridden_fields +// ignore_for_file: unnecessary_cast +// ignore_for_file: unused_element +// ignore_for_file: unused_field +// ignore_for_file: unused_import +// ignore_for_file: unused_local_variable +// ignore_for_file: unused_shown_name +// ignore_for_file: use_super_parameters + +import "dart:isolate" show ReceivePort; +import "dart:ffi" as ffi; +import "package:jni/internal_helpers_for_jnigen.dart"; +import "package:jni/jni.dart" as jni; + +import "Request.dart" as request_; + +import "Headers.dart" as headers_; + +import "ResponseBody.dart" as responsebody_; + +/// from: okhttp3.Response$Builder +class Response_Builder extends jni.JObject { + @override + late final jni.JObjType $type = type; + + Response_Builder.fromReference( + jni.JReference reference, + ) : super.fromReference(reference); + + static final _class = jni.JClass.forName(r"okhttp3/Response$Builder"); + + /// The type which includes information such as the signature of this class. + static const type = $Response_BuilderType(); + static final _id_new0 = _class.constructorId( + r"()V", + ); + + static final _new0 = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + )>>("globalEnv_NewObject") + .asFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + )>(); + + /// from: public void () + /// The returned object must be released after use, by calling the [release] method. + factory Response_Builder() { + return Response_Builder.fromReference( + _new0(_class.reference.pointer, _id_new0 as jni.JMethodIDPtr) + .reference); + } + + static final _id_new1 = _class.constructorId( + r"(Lokhttp3/Response;)V", + ); + + static final _new1 = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + ffi.VarArgs<(ffi.Pointer,)>)>>( + "globalEnv_NewObject") + .asFunction< + jni.JniResult Function(ffi.Pointer, jni.JMethodIDPtr, + ffi.Pointer)>(); + + /// from: public void (okhttp3.Response response) + /// The returned object must be released after use, by calling the [release] method. + factory Response_Builder.new1( + Response response, + ) { + return Response_Builder.fromReference(_new1(_class.reference.pointer, + _id_new1 as jni.JMethodIDPtr, response.reference.pointer) + .reference); + } + + static final _id_request = _class.instanceMethodId( + r"request", + r"(Lokhttp3/Request;)Lokhttp3/Response$Builder;", + ); + + static final _request = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + ffi.VarArgs<(ffi.Pointer,)>)>>( + "globalEnv_CallObjectMethod") + .asFunction< + jni.JniResult Function(ffi.Pointer, jni.JMethodIDPtr, + ffi.Pointer)>(); + + /// from: public okhttp3.Response$Builder request(okhttp3.Request request) + /// The returned object must be released after use, by calling the [release] method. + Response_Builder request( + request_.Request request, + ) { + return _request(reference.pointer, _id_request as jni.JMethodIDPtr, + request.reference.pointer) + .object(const $Response_BuilderType()); + } + + static final _id_protocol = _class.instanceMethodId( + r"protocol", + r"(Lokhttp3/Protocol;)Lokhttp3/Response$Builder;", + ); + + static final _protocol = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + ffi.VarArgs<(ffi.Pointer,)>)>>( + "globalEnv_CallObjectMethod") + .asFunction< + jni.JniResult Function(ffi.Pointer, jni.JMethodIDPtr, + ffi.Pointer)>(); + + /// from: public okhttp3.Response$Builder protocol(okhttp3.Protocol protocol) + /// The returned object must be released after use, by calling the [release] method. + Response_Builder protocol( + jni.JObject protocol, + ) { + return _protocol(reference.pointer, _id_protocol as jni.JMethodIDPtr, + protocol.reference.pointer) + .object(const $Response_BuilderType()); + } + + static final _id_code = _class.instanceMethodId( + r"code", + r"(I)Lokhttp3/Response$Builder;", + ); + + static final _code = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function(ffi.Pointer, jni.JMethodIDPtr, + ffi.VarArgs<(ffi.Int64,)>)>>("globalEnv_CallObjectMethod") + .asFunction< + jni.JniResult Function( + ffi.Pointer, jni.JMethodIDPtr, int)>(); + + /// from: public okhttp3.Response$Builder code(int i) + /// The returned object must be released after use, by calling the [release] method. + Response_Builder code( + int i, + ) { + return _code(reference.pointer, _id_code as jni.JMethodIDPtr, i) + .object(const $Response_BuilderType()); + } + + static final _id_message = _class.instanceMethodId( + r"message", + r"(Ljava/lang/String;)Lokhttp3/Response$Builder;", + ); + + static final _message = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + ffi.VarArgs<(ffi.Pointer,)>)>>( + "globalEnv_CallObjectMethod") + .asFunction< + jni.JniResult Function(ffi.Pointer, jni.JMethodIDPtr, + ffi.Pointer)>(); + + /// from: public okhttp3.Response$Builder message(java.lang.String string) + /// The returned object must be released after use, by calling the [release] method. + Response_Builder message( + jni.JString string, + ) { + return _message(reference.pointer, _id_message as jni.JMethodIDPtr, + string.reference.pointer) + .object(const $Response_BuilderType()); + } + + static final _id_handshake = _class.instanceMethodId( + r"handshake", + r"(Lokhttp3/Handshake;)Lokhttp3/Response$Builder;", + ); + + static final _handshake = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + ffi.VarArgs<(ffi.Pointer,)>)>>( + "globalEnv_CallObjectMethod") + .asFunction< + jni.JniResult Function(ffi.Pointer, jni.JMethodIDPtr, + ffi.Pointer)>(); + + /// from: public okhttp3.Response$Builder handshake(okhttp3.Handshake handshake) + /// The returned object must be released after use, by calling the [release] method. + Response_Builder handshake( + jni.JObject handshake, + ) { + return _handshake(reference.pointer, _id_handshake as jni.JMethodIDPtr, + handshake.reference.pointer) + .object(const $Response_BuilderType()); + } + + static final _id_header = _class.instanceMethodId( + r"header", + r"(Ljava/lang/String;Ljava/lang/String;)Lokhttp3/Response$Builder;", + ); + + static final _header = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + ffi.VarArgs< + ( + ffi.Pointer, + ffi.Pointer + )>)>>("globalEnv_CallObjectMethod") + .asFunction< + jni.JniResult Function(ffi.Pointer, jni.JMethodIDPtr, + ffi.Pointer, ffi.Pointer)>(); + + /// from: public okhttp3.Response$Builder header(java.lang.String string, java.lang.String string1) + /// The returned object must be released after use, by calling the [release] method. + Response_Builder header( + jni.JString string, + jni.JString string1, + ) { + return _header(reference.pointer, _id_header as jni.JMethodIDPtr, + string.reference.pointer, string1.reference.pointer) + .object(const $Response_BuilderType()); + } + + static final _id_addHeader = _class.instanceMethodId( + r"addHeader", + r"(Ljava/lang/String;Ljava/lang/String;)Lokhttp3/Response$Builder;", + ); + + static final _addHeader = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + ffi.VarArgs< + ( + ffi.Pointer, + ffi.Pointer + )>)>>("globalEnv_CallObjectMethod") + .asFunction< + jni.JniResult Function(ffi.Pointer, jni.JMethodIDPtr, + ffi.Pointer, ffi.Pointer)>(); + + /// from: public okhttp3.Response$Builder addHeader(java.lang.String string, java.lang.String string1) + /// The returned object must be released after use, by calling the [release] method. + Response_Builder addHeader( + jni.JString string, + jni.JString string1, + ) { + return _addHeader(reference.pointer, _id_addHeader as jni.JMethodIDPtr, + string.reference.pointer, string1.reference.pointer) + .object(const $Response_BuilderType()); + } + + static final _id_removeHeader = _class.instanceMethodId( + r"removeHeader", + r"(Ljava/lang/String;)Lokhttp3/Response$Builder;", + ); + + static final _removeHeader = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + ffi.VarArgs<(ffi.Pointer,)>)>>( + "globalEnv_CallObjectMethod") + .asFunction< + jni.JniResult Function(ffi.Pointer, jni.JMethodIDPtr, + ffi.Pointer)>(); + + /// from: public okhttp3.Response$Builder removeHeader(java.lang.String string) + /// The returned object must be released after use, by calling the [release] method. + Response_Builder removeHeader( + jni.JString string, + ) { + return _removeHeader(reference.pointer, + _id_removeHeader as jni.JMethodIDPtr, string.reference.pointer) + .object(const $Response_BuilderType()); + } + + static final _id_headers = _class.instanceMethodId( + r"headers", + r"(Lokhttp3/Headers;)Lokhttp3/Response$Builder;", + ); + + static final _headers = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + ffi.VarArgs<(ffi.Pointer,)>)>>( + "globalEnv_CallObjectMethod") + .asFunction< + jni.JniResult Function(ffi.Pointer, jni.JMethodIDPtr, + ffi.Pointer)>(); + + /// from: public okhttp3.Response$Builder headers(okhttp3.Headers headers) + /// The returned object must be released after use, by calling the [release] method. + Response_Builder headers( + headers_.Headers headers, + ) { + return _headers(reference.pointer, _id_headers as jni.JMethodIDPtr, + headers.reference.pointer) + .object(const $Response_BuilderType()); + } + + static final _id_body = _class.instanceMethodId( + r"body", + r"(Lokhttp3/ResponseBody;)Lokhttp3/Response$Builder;", + ); + + static final _body = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + ffi.VarArgs<(ffi.Pointer,)>)>>( + "globalEnv_CallObjectMethod") + .asFunction< + jni.JniResult Function(ffi.Pointer, jni.JMethodIDPtr, + ffi.Pointer)>(); + + /// from: public okhttp3.Response$Builder body(okhttp3.ResponseBody responseBody) + /// The returned object must be released after use, by calling the [release] method. + Response_Builder body( + responsebody_.ResponseBody responseBody, + ) { + return _body(reference.pointer, _id_body as jni.JMethodIDPtr, + responseBody.reference.pointer) + .object(const $Response_BuilderType()); + } + + static final _id_networkResponse = _class.instanceMethodId( + r"networkResponse", + r"(Lokhttp3/Response;)Lokhttp3/Response$Builder;", + ); + + static final _networkResponse = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + ffi.VarArgs<(ffi.Pointer,)>)>>( + "globalEnv_CallObjectMethod") + .asFunction< + jni.JniResult Function(ffi.Pointer, jni.JMethodIDPtr, + ffi.Pointer)>(); + + /// from: public okhttp3.Response$Builder networkResponse(okhttp3.Response response) + /// The returned object must be released after use, by calling the [release] method. + Response_Builder networkResponse( + Response response, + ) { + return _networkResponse(reference.pointer, + _id_networkResponse as jni.JMethodIDPtr, response.reference.pointer) + .object(const $Response_BuilderType()); + } + + static final _id_cacheResponse = _class.instanceMethodId( + r"cacheResponse", + r"(Lokhttp3/Response;)Lokhttp3/Response$Builder;", + ); + + static final _cacheResponse = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + ffi.VarArgs<(ffi.Pointer,)>)>>( + "globalEnv_CallObjectMethod") + .asFunction< + jni.JniResult Function(ffi.Pointer, jni.JMethodIDPtr, + ffi.Pointer)>(); + + /// from: public okhttp3.Response$Builder cacheResponse(okhttp3.Response response) + /// The returned object must be released after use, by calling the [release] method. + Response_Builder cacheResponse( + Response response, + ) { + return _cacheResponse(reference.pointer, + _id_cacheResponse as jni.JMethodIDPtr, response.reference.pointer) + .object(const $Response_BuilderType()); + } + + static final _id_priorResponse = _class.instanceMethodId( + r"priorResponse", + r"(Lokhttp3/Response;)Lokhttp3/Response$Builder;", + ); + + static final _priorResponse = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + ffi.VarArgs<(ffi.Pointer,)>)>>( + "globalEnv_CallObjectMethod") + .asFunction< + jni.JniResult Function(ffi.Pointer, jni.JMethodIDPtr, + ffi.Pointer)>(); + + /// from: public okhttp3.Response$Builder priorResponse(okhttp3.Response response) + /// The returned object must be released after use, by calling the [release] method. + Response_Builder priorResponse( + Response response, + ) { + return _priorResponse(reference.pointer, + _id_priorResponse as jni.JMethodIDPtr, response.reference.pointer) + .object(const $Response_BuilderType()); + } + + static final _id_sentRequestAtMillis = _class.instanceMethodId( + r"sentRequestAtMillis", + r"(J)Lokhttp3/Response$Builder;", + ); + + static final _sentRequestAtMillis = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function(ffi.Pointer, jni.JMethodIDPtr, + ffi.VarArgs<(ffi.Int64,)>)>>("globalEnv_CallObjectMethod") + .asFunction< + jni.JniResult Function( + ffi.Pointer, jni.JMethodIDPtr, int)>(); + + /// from: public okhttp3.Response$Builder sentRequestAtMillis(long j) + /// The returned object must be released after use, by calling the [release] method. + Response_Builder sentRequestAtMillis( + int j, + ) { + return _sentRequestAtMillis( + reference.pointer, _id_sentRequestAtMillis as jni.JMethodIDPtr, j) + .object(const $Response_BuilderType()); + } + + static final _id_receivedResponseAtMillis = _class.instanceMethodId( + r"receivedResponseAtMillis", + r"(J)Lokhttp3/Response$Builder;", + ); + + static final _receivedResponseAtMillis = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function(ffi.Pointer, jni.JMethodIDPtr, + ffi.VarArgs<(ffi.Int64,)>)>>("globalEnv_CallObjectMethod") + .asFunction< + jni.JniResult Function( + ffi.Pointer, jni.JMethodIDPtr, int)>(); + + /// from: public okhttp3.Response$Builder receivedResponseAtMillis(long j) + /// The returned object must be released after use, by calling the [release] method. + Response_Builder receivedResponseAtMillis( + int j, + ) { + return _receivedResponseAtMillis(reference.pointer, + _id_receivedResponseAtMillis as jni.JMethodIDPtr, j) + .object(const $Response_BuilderType()); + } + + static final _id_build = _class.instanceMethodId( + r"build", + r"()Lokhttp3/Response;", + ); + + static final _build = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + )>>("globalEnv_CallObjectMethod") + .asFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + )>(); + + /// from: public okhttp3.Response build() + /// The returned object must be released after use, by calling the [release] method. + Response build() { + return _build(reference.pointer, _id_build as jni.JMethodIDPtr) + .object(const $ResponseType()); + } +} + +final class $Response_BuilderType extends jni.JObjType { + const $Response_BuilderType(); + + @override + String get signature => r"Lokhttp3/Response$Builder;"; + + @override + Response_Builder fromReference(jni.JReference reference) => + Response_Builder.fromReference(reference); + + @override + jni.JObjType get superType => const jni.JObjectType(); + + @override + final superCount = 1; + + @override + int get hashCode => ($Response_BuilderType).hashCode; + + @override + bool operator ==(Object other) { + return other.runtimeType == ($Response_BuilderType) && + other is $Response_BuilderType; + } +} + +/// from: okhttp3.Response +class Response extends jni.JObject { + @override + late final jni.JObjType $type = type; + + Response.fromReference( + jni.JReference reference, + ) : super.fromReference(reference); + + static final _class = jni.JClass.forName(r"okhttp3/Response"); + + /// The type which includes information such as the signature of this class. + static const type = $ResponseType(); + static final _id_new0 = _class.constructorId( + r"(Lokhttp3/Request;Lokhttp3/Protocol;Ljava/lang/String;ILokhttp3/Handshake;Lokhttp3/Headers;Lokhttp3/ResponseBody;Lokhttp3/Response;Lokhttp3/Response;Lokhttp3/Response;JJLokhttp3/internal/connection/Exchange;)V", + ); + + static final _new0 = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + ffi.VarArgs< + ( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Int64, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Int64, + ffi.Int64, + ffi.Pointer + )>)>>("globalEnv_NewObject") + .asFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + int, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + int, + int, + ffi.Pointer)>(); + + /// from: public void (okhttp3.Request request, okhttp3.Protocol protocol, java.lang.String string, int i, okhttp3.Handshake handshake, okhttp3.Headers headers, okhttp3.ResponseBody responseBody, okhttp3.Response response, okhttp3.Response response1, okhttp3.Response response2, long j, long j1, okhttp3.internal.connection.Exchange exchange) + /// The returned object must be released after use, by calling the [release] method. + factory Response( + request_.Request request, + jni.JObject protocol, + jni.JString string, + int i, + jni.JObject handshake, + headers_.Headers headers, + responsebody_.ResponseBody responseBody, + Response response, + Response response1, + Response response2, + int j, + int j1, + jni.JObject exchange, + ) { + return Response.fromReference(_new0( + _class.reference.pointer, + _id_new0 as jni.JMethodIDPtr, + request.reference.pointer, + protocol.reference.pointer, + string.reference.pointer, + i, + handshake.reference.pointer, + headers.reference.pointer, + responseBody.reference.pointer, + response.reference.pointer, + response1.reference.pointer, + response2.reference.pointer, + j, + j1, + exchange.reference.pointer) + .reference); + } + + static final _id_request = _class.instanceMethodId( + r"request", + r"()Lokhttp3/Request;", + ); + + static final _request = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + )>>("globalEnv_CallObjectMethod") + .asFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + )>(); + + /// from: public final okhttp3.Request request() + /// The returned object must be released after use, by calling the [release] method. + request_.Request request() { + return _request(reference.pointer, _id_request as jni.JMethodIDPtr) + .object(const request_.$RequestType()); + } + + static final _id_protocol = _class.instanceMethodId( + r"protocol", + r"()Lokhttp3/Protocol;", + ); + + static final _protocol = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + )>>("globalEnv_CallObjectMethod") + .asFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + )>(); + + /// from: public final okhttp3.Protocol protocol() + /// The returned object must be released after use, by calling the [release] method. + jni.JObject protocol() { + return _protocol(reference.pointer, _id_protocol as jni.JMethodIDPtr) + .object(const jni.JObjectType()); + } + + static final _id_message = _class.instanceMethodId( + r"message", + r"()Ljava/lang/String;", + ); + + static final _message = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + )>>("globalEnv_CallObjectMethod") + .asFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + )>(); + + /// from: public final java.lang.String message() + /// The returned object must be released after use, by calling the [release] method. + jni.JString message() { + return _message(reference.pointer, _id_message as jni.JMethodIDPtr) + .object(const jni.JStringType()); + } + + static final _id_code = _class.instanceMethodId( + r"code", + r"()I", + ); + + static final _code = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + )>>("globalEnv_CallIntMethod") + .asFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + )>(); + + /// from: public final int code() + int code() { + return _code(reference.pointer, _id_code as jni.JMethodIDPtr).integer; + } + + static final _id_handshake = _class.instanceMethodId( + r"handshake", + r"()Lokhttp3/Handshake;", + ); + + static final _handshake = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + )>>("globalEnv_CallObjectMethod") + .asFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + )>(); + + /// from: public final okhttp3.Handshake handshake() + /// The returned object must be released after use, by calling the [release] method. + jni.JObject handshake() { + return _handshake(reference.pointer, _id_handshake as jni.JMethodIDPtr) + .object(const jni.JObjectType()); + } + + static final _id_headers = _class.instanceMethodId( + r"headers", + r"()Lokhttp3/Headers;", + ); + + static final _headers = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + )>>("globalEnv_CallObjectMethod") + .asFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + )>(); + + /// from: public final okhttp3.Headers headers() + /// The returned object must be released after use, by calling the [release] method. + headers_.Headers headers() { + return _headers(reference.pointer, _id_headers as jni.JMethodIDPtr) + .object(const headers_.$HeadersType()); + } + + static final _id_body = _class.instanceMethodId( + r"body", + r"()Lokhttp3/ResponseBody;", + ); + + static final _body = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + )>>("globalEnv_CallObjectMethod") + .asFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + )>(); + + /// from: public final okhttp3.ResponseBody body() + /// The returned object must be released after use, by calling the [release] method. + responsebody_.ResponseBody body() { + return _body(reference.pointer, _id_body as jni.JMethodIDPtr) + .object(const responsebody_.$ResponseBodyType()); + } + + static final _id_networkResponse = _class.instanceMethodId( + r"networkResponse", + r"()Lokhttp3/Response;", + ); + + static final _networkResponse = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + )>>("globalEnv_CallObjectMethod") + .asFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + )>(); + + /// from: public final okhttp3.Response networkResponse() + /// The returned object must be released after use, by calling the [release] method. + Response networkResponse() { + return _networkResponse( + reference.pointer, _id_networkResponse as jni.JMethodIDPtr) + .object(const $ResponseType()); + } + + static final _id_cacheResponse = _class.instanceMethodId( + r"cacheResponse", + r"()Lokhttp3/Response;", + ); + + static final _cacheResponse = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + )>>("globalEnv_CallObjectMethod") + .asFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + )>(); + + /// from: public final okhttp3.Response cacheResponse() + /// The returned object must be released after use, by calling the [release] method. + Response cacheResponse() { + return _cacheResponse( + reference.pointer, _id_cacheResponse as jni.JMethodIDPtr) + .object(const $ResponseType()); + } + + static final _id_priorResponse = _class.instanceMethodId( + r"priorResponse", + r"()Lokhttp3/Response;", + ); + + static final _priorResponse = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + )>>("globalEnv_CallObjectMethod") + .asFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + )>(); + + /// from: public final okhttp3.Response priorResponse() + /// The returned object must be released after use, by calling the [release] method. + Response priorResponse() { + return _priorResponse( + reference.pointer, _id_priorResponse as jni.JMethodIDPtr) + .object(const $ResponseType()); + } + + static final _id_sentRequestAtMillis = _class.instanceMethodId( + r"sentRequestAtMillis", + r"()J", + ); + + static final _sentRequestAtMillis = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + )>>("globalEnv_CallLongMethod") + .asFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + )>(); + + /// from: public final long sentRequestAtMillis() + int sentRequestAtMillis() { + return _sentRequestAtMillis( + reference.pointer, _id_sentRequestAtMillis as jni.JMethodIDPtr) + .long; + } + + static final _id_receivedResponseAtMillis = _class.instanceMethodId( + r"receivedResponseAtMillis", + r"()J", + ); + + static final _receivedResponseAtMillis = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + )>>("globalEnv_CallLongMethod") + .asFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + )>(); + + /// from: public final long receivedResponseAtMillis() + int receivedResponseAtMillis() { + return _receivedResponseAtMillis( + reference.pointer, _id_receivedResponseAtMillis as jni.JMethodIDPtr) + .long; + } + + static final _id_exchange = _class.instanceMethodId( + r"exchange", + r"()Lokhttp3/internal/connection/Exchange;", + ); + + static final _exchange = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + )>>("globalEnv_CallObjectMethod") + .asFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + )>(); + + /// from: public final okhttp3.internal.connection.Exchange exchange() + /// The returned object must be released after use, by calling the [release] method. + jni.JObject exchange() { + return _exchange(reference.pointer, _id_exchange as jni.JMethodIDPtr) + .object(const jni.JObjectType()); + } + + static final _id_isSuccessful = _class.instanceMethodId( + r"isSuccessful", + r"()Z", + ); + + static final _isSuccessful = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + )>>("globalEnv_CallBooleanMethod") + .asFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + )>(); + + /// from: public final boolean isSuccessful() + bool isSuccessful() { + return _isSuccessful( + reference.pointer, _id_isSuccessful as jni.JMethodIDPtr) + .boolean; + } + + static final _id_headers1 = _class.instanceMethodId( + r"headers", + r"(Ljava/lang/String;)Ljava/util/List;", + ); + + static final _headers1 = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + ffi.VarArgs<(ffi.Pointer,)>)>>( + "globalEnv_CallObjectMethod") + .asFunction< + jni.JniResult Function(ffi.Pointer, jni.JMethodIDPtr, + ffi.Pointer)>(); + + /// from: public final java.util.List headers(java.lang.String string) + /// The returned object must be released after use, by calling the [release] method. + jni.JList headers1( + jni.JString string, + ) { + return _headers1(reference.pointer, _id_headers1 as jni.JMethodIDPtr, + string.reference.pointer) + .object(const jni.JListType(jni.JStringType())); + } + + static final _id_header = _class.instanceMethodId( + r"header", + r"(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;", + ); + + static final _header = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + ffi.VarArgs< + ( + ffi.Pointer, + ffi.Pointer + )>)>>("globalEnv_CallObjectMethod") + .asFunction< + jni.JniResult Function(ffi.Pointer, jni.JMethodIDPtr, + ffi.Pointer, ffi.Pointer)>(); + + /// from: public final java.lang.String header(java.lang.String string, java.lang.String string1) + /// The returned object must be released after use, by calling the [release] method. + jni.JString header( + jni.JString string, + jni.JString string1, + ) { + return _header(reference.pointer, _id_header as jni.JMethodIDPtr, + string.reference.pointer, string1.reference.pointer) + .object(const jni.JStringType()); + } + + static final _id_trailers = _class.instanceMethodId( + r"trailers", + r"()Lokhttp3/Headers;", + ); + + static final _trailers = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + )>>("globalEnv_CallObjectMethod") + .asFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + )>(); + + /// from: public final okhttp3.Headers trailers() + /// The returned object must be released after use, by calling the [release] method. + headers_.Headers trailers() { + return _trailers(reference.pointer, _id_trailers as jni.JMethodIDPtr) + .object(const headers_.$HeadersType()); + } + + static final _id_peekBody = _class.instanceMethodId( + r"peekBody", + r"(J)Lokhttp3/ResponseBody;", + ); + + static final _peekBody = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function(ffi.Pointer, jni.JMethodIDPtr, + ffi.VarArgs<(ffi.Int64,)>)>>("globalEnv_CallObjectMethod") + .asFunction< + jni.JniResult Function( + ffi.Pointer, jni.JMethodIDPtr, int)>(); + + /// from: public final okhttp3.ResponseBody peekBody(long j) + /// The returned object must be released after use, by calling the [release] method. + responsebody_.ResponseBody peekBody( + int j, + ) { + return _peekBody(reference.pointer, _id_peekBody as jni.JMethodIDPtr, j) + .object(const responsebody_.$ResponseBodyType()); + } + + static final _id_newBuilder = _class.instanceMethodId( + r"newBuilder", + r"()Lokhttp3/Response$Builder;", + ); + + static final _newBuilder = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + )>>("globalEnv_CallObjectMethod") + .asFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + )>(); + + /// from: public final okhttp3.Response$Builder newBuilder() + /// The returned object must be released after use, by calling the [release] method. + Response_Builder newBuilder() { + return _newBuilder(reference.pointer, _id_newBuilder as jni.JMethodIDPtr) + .object(const $Response_BuilderType()); + } + + static final _id_isRedirect = _class.instanceMethodId( + r"isRedirect", + r"()Z", + ); + + static final _isRedirect = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + )>>("globalEnv_CallBooleanMethod") + .asFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + )>(); + + /// from: public final boolean isRedirect() + bool isRedirect() { + return _isRedirect(reference.pointer, _id_isRedirect as jni.JMethodIDPtr) + .boolean; + } + + static final _id_challenges = _class.instanceMethodId( + r"challenges", + r"()Ljava/util/List;", + ); + + static final _challenges = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + )>>("globalEnv_CallObjectMethod") + .asFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + )>(); + + /// from: public final java.util.List challenges() + /// The returned object must be released after use, by calling the [release] method. + jni.JList challenges() { + return _challenges(reference.pointer, _id_challenges as jni.JMethodIDPtr) + .object(const jni.JListType(jni.JObjectType())); + } + + static final _id_cacheControl = _class.instanceMethodId( + r"cacheControl", + r"()Lokhttp3/CacheControl;", + ); + + static final _cacheControl = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + )>>("globalEnv_CallObjectMethod") + .asFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + )>(); + + /// from: public final okhttp3.CacheControl cacheControl() + /// The returned object must be released after use, by calling the [release] method. + jni.JObject cacheControl() { + return _cacheControl( + reference.pointer, _id_cacheControl as jni.JMethodIDPtr) + .object(const jni.JObjectType()); + } + + static final _id_close = _class.instanceMethodId( + r"close", + r"()V", + ); + + static final _close = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JThrowablePtr Function( + ffi.Pointer, + jni.JMethodIDPtr, + )>>("globalEnv_CallVoidMethod") + .asFunction< + jni.JThrowablePtr Function( + ffi.Pointer, + jni.JMethodIDPtr, + )>(); + + /// from: public void close() + void close() { + _close(reference.pointer, _id_close as jni.JMethodIDPtr).check(); + } + + static final _id_toString1 = _class.instanceMethodId( + r"toString", + r"()Ljava/lang/String;", + ); + + static final _toString1 = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + )>>("globalEnv_CallObjectMethod") + .asFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + )>(); + + /// from: public java.lang.String toString() + /// The returned object must be released after use, by calling the [release] method. + jni.JString toString1() { + return _toString1(reference.pointer, _id_toString1 as jni.JMethodIDPtr) + .object(const jni.JStringType()); + } + + static final _id_header1 = _class.instanceMethodId( + r"header", + r"(Ljava/lang/String;)Ljava/lang/String;", + ); + + static final _header1 = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + ffi.VarArgs<(ffi.Pointer,)>)>>( + "globalEnv_CallObjectMethod") + .asFunction< + jni.JniResult Function(ffi.Pointer, jni.JMethodIDPtr, + ffi.Pointer)>(); + + /// from: public final java.lang.String header(java.lang.String string) + /// The returned object must be released after use, by calling the [release] method. + jni.JString header1( + jni.JString string, + ) { + return _header1(reference.pointer, _id_header1 as jni.JMethodIDPtr, + string.reference.pointer) + .object(const jni.JStringType()); + } +} + +final class $ResponseType extends jni.JObjType { + const $ResponseType(); + + @override + String get signature => r"Lokhttp3/Response;"; + + @override + Response fromReference(jni.JReference reference) => + Response.fromReference(reference); + + @override + jni.JObjType get superType => const jni.JObjectType(); + + @override + final superCount = 1; + + @override + int get hashCode => ($ResponseType).hashCode; + + @override + bool operator ==(Object other) { + return other.runtimeType == ($ResponseType) && other is $ResponseType; + } +} diff --git a/pkgs/ok_http/lib/src/third_party/okhttp3/ResponseBody.dart b/pkgs/ok_http/lib/src/third_party/okhttp3/ResponseBody.dart new file mode 100644 index 0000000000..70514819d4 --- /dev/null +++ b/pkgs/ok_http/lib/src/third_party/okhttp3/ResponseBody.dart @@ -0,0 +1,995 @@ +// Autogenerated by jnigen. DO NOT EDIT! + +// ignore_for_file: annotate_overrides +// ignore_for_file: camel_case_extensions +// ignore_for_file: camel_case_types +// ignore_for_file: constant_identifier_names +// ignore_for_file: doc_directive_unknown +// ignore_for_file: file_names +// ignore_for_file: lines_longer_than_80_chars +// ignore_for_file: no_leading_underscores_for_local_identifiers +// ignore_for_file: non_constant_identifier_names +// ignore_for_file: overridden_fields +// ignore_for_file: unnecessary_cast +// ignore_for_file: unused_element +// ignore_for_file: unused_field +// ignore_for_file: unused_import +// ignore_for_file: unused_local_variable +// ignore_for_file: unused_shown_name +// ignore_for_file: use_super_parameters + +import "dart:isolate" show ReceivePort; +import "dart:ffi" as ffi; +import "package:jni/internal_helpers_for_jnigen.dart"; +import "package:jni/jni.dart" as jni; + +/// from: okhttp3.ResponseBody$BomAwareReader +class ResponseBody_BomAwareReader extends jni.JObject { + @override + late final jni.JObjType $type = type; + + ResponseBody_BomAwareReader.fromReference( + jni.JReference reference, + ) : super.fromReference(reference); + + static final _class = + jni.JClass.forName(r"okhttp3/ResponseBody$BomAwareReader"); + + /// The type which includes information such as the signature of this class. + static const type = $ResponseBody_BomAwareReaderType(); + static final _id_new0 = _class.constructorId( + r"(Lokio/BufferedSource;Ljava/nio/charset/Charset;)V", + ); + + static final _new0 = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + ffi.VarArgs< + ( + ffi.Pointer, + ffi.Pointer + )>)>>("globalEnv_NewObject") + .asFunction< + jni.JniResult Function(ffi.Pointer, jni.JMethodIDPtr, + ffi.Pointer, ffi.Pointer)>(); + + /// from: public void (okio.BufferedSource bufferedSource, java.nio.charset.Charset charset) + /// The returned object must be released after use, by calling the [release] method. + factory ResponseBody_BomAwareReader( + jni.JObject bufferedSource, + jni.JObject charset, + ) { + return ResponseBody_BomAwareReader.fromReference(_new0( + _class.reference.pointer, + _id_new0 as jni.JMethodIDPtr, + bufferedSource.reference.pointer, + charset.reference.pointer) + .reference); + } + + static final _id_read = _class.instanceMethodId( + r"read", + r"([CII)I", + ); + + static final _read = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + ffi.VarArgs< + ( + ffi.Pointer, + ffi.Int64, + ffi.Int64 + )>)>>("globalEnv_CallIntMethod") + .asFunction< + jni.JniResult Function(ffi.Pointer, jni.JMethodIDPtr, + ffi.Pointer, int, int)>(); + + /// from: public int read(char[] cs, int i, int i1) + int read( + jni.JArray cs, + int i, + int i1, + ) { + return _read(reference.pointer, _id_read as jni.JMethodIDPtr, + cs.reference.pointer, i, i1) + .integer; + } + + static final _id_close = _class.instanceMethodId( + r"close", + r"()V", + ); + + static final _close = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JThrowablePtr Function( + ffi.Pointer, + jni.JMethodIDPtr, + )>>("globalEnv_CallVoidMethod") + .asFunction< + jni.JThrowablePtr Function( + ffi.Pointer, + jni.JMethodIDPtr, + )>(); + + /// from: public void close() + void close() { + _close(reference.pointer, _id_close as jni.JMethodIDPtr).check(); + } +} + +final class $ResponseBody_BomAwareReaderType + extends jni.JObjType { + const $ResponseBody_BomAwareReaderType(); + + @override + String get signature => r"Lokhttp3/ResponseBody$BomAwareReader;"; + + @override + ResponseBody_BomAwareReader fromReference(jni.JReference reference) => + ResponseBody_BomAwareReader.fromReference(reference); + + @override + jni.JObjType get superType => const jni.JObjectType(); + + @override + final superCount = 1; + + @override + int get hashCode => ($ResponseBody_BomAwareReaderType).hashCode; + + @override + bool operator ==(Object other) { + return other.runtimeType == ($ResponseBody_BomAwareReaderType) && + other is $ResponseBody_BomAwareReaderType; + } +} + +/// from: okhttp3.ResponseBody$Companion +class ResponseBody_Companion extends jni.JObject { + @override + late final jni.JObjType $type = type; + + ResponseBody_Companion.fromReference( + jni.JReference reference, + ) : super.fromReference(reference); + + static final _class = jni.JClass.forName(r"okhttp3/ResponseBody$Companion"); + + /// The type which includes information such as the signature of this class. + static const type = $ResponseBody_CompanionType(); + static final _id_create = _class.instanceMethodId( + r"create", + r"(Ljava/lang/String;Lokhttp3/MediaType;)Lokhttp3/ResponseBody;", + ); + + static final _create = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + ffi.VarArgs< + ( + ffi.Pointer, + ffi.Pointer + )>)>>("globalEnv_CallObjectMethod") + .asFunction< + jni.JniResult Function(ffi.Pointer, jni.JMethodIDPtr, + ffi.Pointer, ffi.Pointer)>(); + + /// from: public final okhttp3.ResponseBody create(java.lang.String string, okhttp3.MediaType mediaType) + /// The returned object must be released after use, by calling the [release] method. + ResponseBody create( + jni.JString string, + jni.JObject mediaType, + ) { + return _create(reference.pointer, _id_create as jni.JMethodIDPtr, + string.reference.pointer, mediaType.reference.pointer) + .object(const $ResponseBodyType()); + } + + static final _id_create1 = _class.instanceMethodId( + r"create", + r"([BLokhttp3/MediaType;)Lokhttp3/ResponseBody;", + ); + + static final _create1 = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + ffi.VarArgs< + ( + ffi.Pointer, + ffi.Pointer + )>)>>("globalEnv_CallObjectMethod") + .asFunction< + jni.JniResult Function(ffi.Pointer, jni.JMethodIDPtr, + ffi.Pointer, ffi.Pointer)>(); + + /// from: public final okhttp3.ResponseBody create(byte[] bs, okhttp3.MediaType mediaType) + /// The returned object must be released after use, by calling the [release] method. + ResponseBody create1( + jni.JArray bs, + jni.JObject mediaType, + ) { + return _create1(reference.pointer, _id_create1 as jni.JMethodIDPtr, + bs.reference.pointer, mediaType.reference.pointer) + .object(const $ResponseBodyType()); + } + + static final _id_create2 = _class.instanceMethodId( + r"create", + r"(Lokio/ByteString;Lokhttp3/MediaType;)Lokhttp3/ResponseBody;", + ); + + static final _create2 = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + ffi.VarArgs< + ( + ffi.Pointer, + ffi.Pointer + )>)>>("globalEnv_CallObjectMethod") + .asFunction< + jni.JniResult Function(ffi.Pointer, jni.JMethodIDPtr, + ffi.Pointer, ffi.Pointer)>(); + + /// from: public final okhttp3.ResponseBody create(okio.ByteString byteString, okhttp3.MediaType mediaType) + /// The returned object must be released after use, by calling the [release] method. + ResponseBody create2( + jni.JObject byteString, + jni.JObject mediaType, + ) { + return _create2(reference.pointer, _id_create2 as jni.JMethodIDPtr, + byteString.reference.pointer, mediaType.reference.pointer) + .object(const $ResponseBodyType()); + } + + static final _id_create3 = _class.instanceMethodId( + r"create", + r"(Lokio/BufferedSource;Lokhttp3/MediaType;J)Lokhttp3/ResponseBody;", + ); + + static final _create3 = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + ffi.VarArgs< + ( + ffi.Pointer, + ffi.Pointer, + ffi.Int64 + )>)>>("globalEnv_CallObjectMethod") + .asFunction< + jni.JniResult Function(ffi.Pointer, jni.JMethodIDPtr, + ffi.Pointer, ffi.Pointer, int)>(); + + /// from: public final okhttp3.ResponseBody create(okio.BufferedSource bufferedSource, okhttp3.MediaType mediaType, long j) + /// The returned object must be released after use, by calling the [release] method. + ResponseBody create3( + jni.JObject bufferedSource, + jni.JObject mediaType, + int j, + ) { + return _create3(reference.pointer, _id_create3 as jni.JMethodIDPtr, + bufferedSource.reference.pointer, mediaType.reference.pointer, j) + .object(const $ResponseBodyType()); + } + + static final _id_create4 = _class.instanceMethodId( + r"create", + r"(Lokhttp3/MediaType;Ljava/lang/String;)Lokhttp3/ResponseBody;", + ); + + static final _create4 = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + ffi.VarArgs< + ( + ffi.Pointer, + ffi.Pointer + )>)>>("globalEnv_CallObjectMethod") + .asFunction< + jni.JniResult Function(ffi.Pointer, jni.JMethodIDPtr, + ffi.Pointer, ffi.Pointer)>(); + + /// from: public final okhttp3.ResponseBody create(okhttp3.MediaType mediaType, java.lang.String string) + /// The returned object must be released after use, by calling the [release] method. + ResponseBody create4( + jni.JObject mediaType, + jni.JString string, + ) { + return _create4(reference.pointer, _id_create4 as jni.JMethodIDPtr, + mediaType.reference.pointer, string.reference.pointer) + .object(const $ResponseBodyType()); + } + + static final _id_create5 = _class.instanceMethodId( + r"create", + r"(Lokhttp3/MediaType;[B)Lokhttp3/ResponseBody;", + ); + + static final _create5 = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + ffi.VarArgs< + ( + ffi.Pointer, + ffi.Pointer + )>)>>("globalEnv_CallObjectMethod") + .asFunction< + jni.JniResult Function(ffi.Pointer, jni.JMethodIDPtr, + ffi.Pointer, ffi.Pointer)>(); + + /// from: public final okhttp3.ResponseBody create(okhttp3.MediaType mediaType, byte[] bs) + /// The returned object must be released after use, by calling the [release] method. + ResponseBody create5( + jni.JObject mediaType, + jni.JArray bs, + ) { + return _create5(reference.pointer, _id_create5 as jni.JMethodIDPtr, + mediaType.reference.pointer, bs.reference.pointer) + .object(const $ResponseBodyType()); + } + + static final _id_create6 = _class.instanceMethodId( + r"create", + r"(Lokhttp3/MediaType;Lokio/ByteString;)Lokhttp3/ResponseBody;", + ); + + static final _create6 = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + ffi.VarArgs< + ( + ffi.Pointer, + ffi.Pointer + )>)>>("globalEnv_CallObjectMethod") + .asFunction< + jni.JniResult Function(ffi.Pointer, jni.JMethodIDPtr, + ffi.Pointer, ffi.Pointer)>(); + + /// from: public final okhttp3.ResponseBody create(okhttp3.MediaType mediaType, okio.ByteString byteString) + /// The returned object must be released after use, by calling the [release] method. + ResponseBody create6( + jni.JObject mediaType, + jni.JObject byteString, + ) { + return _create6(reference.pointer, _id_create6 as jni.JMethodIDPtr, + mediaType.reference.pointer, byteString.reference.pointer) + .object(const $ResponseBodyType()); + } + + static final _id_create7 = _class.instanceMethodId( + r"create", + r"(Lokhttp3/MediaType;JLokio/BufferedSource;)Lokhttp3/ResponseBody;", + ); + + static final _create7 = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + ffi.VarArgs< + ( + ffi.Pointer, + ffi.Int64, + ffi.Pointer + )>)>>("globalEnv_CallObjectMethod") + .asFunction< + jni.JniResult Function(ffi.Pointer, jni.JMethodIDPtr, + ffi.Pointer, int, ffi.Pointer)>(); + + /// from: public final okhttp3.ResponseBody create(okhttp3.MediaType mediaType, long j, okio.BufferedSource bufferedSource) + /// The returned object must be released after use, by calling the [release] method. + ResponseBody create7( + jni.JObject mediaType, + int j, + jni.JObject bufferedSource, + ) { + return _create7(reference.pointer, _id_create7 as jni.JMethodIDPtr, + mediaType.reference.pointer, j, bufferedSource.reference.pointer) + .object(const $ResponseBodyType()); + } + + static final _id_new0 = _class.constructorId( + r"(Lkotlin/jvm/internal/DefaultConstructorMarker;)V", + ); + + static final _new0 = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + ffi.VarArgs<(ffi.Pointer,)>)>>( + "globalEnv_NewObject") + .asFunction< + jni.JniResult Function(ffi.Pointer, jni.JMethodIDPtr, + ffi.Pointer)>(); + + /// from: public void (kotlin.jvm.internal.DefaultConstructorMarker defaultConstructorMarker) + /// The returned object must be released after use, by calling the [release] method. + factory ResponseBody_Companion( + jni.JObject defaultConstructorMarker, + ) { + return ResponseBody_Companion.fromReference(_new0( + _class.reference.pointer, + _id_new0 as jni.JMethodIDPtr, + defaultConstructorMarker.reference.pointer) + .reference); + } +} + +final class $ResponseBody_CompanionType + extends jni.JObjType { + const $ResponseBody_CompanionType(); + + @override + String get signature => r"Lokhttp3/ResponseBody$Companion;"; + + @override + ResponseBody_Companion fromReference(jni.JReference reference) => + ResponseBody_Companion.fromReference(reference); + + @override + jni.JObjType get superType => const jni.JObjectType(); + + @override + final superCount = 1; + + @override + int get hashCode => ($ResponseBody_CompanionType).hashCode; + + @override + bool operator ==(Object other) { + return other.runtimeType == ($ResponseBody_CompanionType) && + other is $ResponseBody_CompanionType; + } +} + +/// from: okhttp3.ResponseBody +class ResponseBody extends jni.JObject { + @override + late final jni.JObjType $type = type; + + ResponseBody.fromReference( + jni.JReference reference, + ) : super.fromReference(reference); + + static final _class = jni.JClass.forName(r"okhttp3/ResponseBody"); + + /// The type which includes information such as the signature of this class. + static const type = $ResponseBodyType(); + static final _id_Companion = _class.staticFieldId( + r"Companion", + r"Lokhttp3/ResponseBody$Companion;", + ); + + /// from: static public final okhttp3.ResponseBody$Companion Companion + /// The returned object must be released after use, by calling the [release] method. + static ResponseBody_Companion get Companion => + _id_Companion.get(_class, const $ResponseBody_CompanionType()); + + static final _id_new0 = _class.constructorId( + r"()V", + ); + + static final _new0 = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + )>>("globalEnv_NewObject") + .asFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + )>(); + + /// from: public void () + /// The returned object must be released after use, by calling the [release] method. + factory ResponseBody() { + return ResponseBody.fromReference( + _new0(_class.reference.pointer, _id_new0 as jni.JMethodIDPtr) + .reference); + } + + static final _id_contentType = _class.instanceMethodId( + r"contentType", + r"()Lokhttp3/MediaType;", + ); + + static final _contentType = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + )>>("globalEnv_CallObjectMethod") + .asFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + )>(); + + /// from: public abstract okhttp3.MediaType contentType() + /// The returned object must be released after use, by calling the [release] method. + jni.JObject contentType() { + return _contentType(reference.pointer, _id_contentType as jni.JMethodIDPtr) + .object(const jni.JObjectType()); + } + + static final _id_contentLength = _class.instanceMethodId( + r"contentLength", + r"()J", + ); + + static final _contentLength = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + )>>("globalEnv_CallLongMethod") + .asFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + )>(); + + /// from: public abstract long contentLength() + int contentLength() { + return _contentLength( + reference.pointer, _id_contentLength as jni.JMethodIDPtr) + .long; + } + + static final _id_byteStream = _class.instanceMethodId( + r"byteStream", + r"()Ljava/io/InputStream;", + ); + + static final _byteStream = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + )>>("globalEnv_CallObjectMethod") + .asFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + )>(); + + /// from: public final java.io.InputStream byteStream() + /// The returned object must be released after use, by calling the [release] method. + jni.JObject byteStream() { + return _byteStream(reference.pointer, _id_byteStream as jni.JMethodIDPtr) + .object(const jni.JObjectType()); + } + + static final _id_source = _class.instanceMethodId( + r"source", + r"()Lokio/BufferedSource;", + ); + + static final _source = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + )>>("globalEnv_CallObjectMethod") + .asFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + )>(); + + /// from: public abstract okio.BufferedSource source() + /// The returned object must be released after use, by calling the [release] method. + jni.JObject source() { + return _source(reference.pointer, _id_source as jni.JMethodIDPtr) + .object(const jni.JObjectType()); + } + + static final _id_bytes = _class.instanceMethodId( + r"bytes", + r"()[B", + ); + + static final _bytes = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + )>>("globalEnv_CallObjectMethod") + .asFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + )>(); + + /// from: public final byte[] bytes() + /// The returned object must be released after use, by calling the [release] method. + jni.JArray bytes() { + return _bytes(reference.pointer, _id_bytes as jni.JMethodIDPtr) + .object(const jni.JArrayType(jni.jbyteType())); + } + + static final _id_byteString = _class.instanceMethodId( + r"byteString", + r"()Lokio/ByteString;", + ); + + static final _byteString = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + )>>("globalEnv_CallObjectMethod") + .asFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + )>(); + + /// from: public final okio.ByteString byteString() + /// The returned object must be released after use, by calling the [release] method. + jni.JObject byteString() { + return _byteString(reference.pointer, _id_byteString as jni.JMethodIDPtr) + .object(const jni.JObjectType()); + } + + static final _id_charStream = _class.instanceMethodId( + r"charStream", + r"()Ljava/io/Reader;", + ); + + static final _charStream = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + )>>("globalEnv_CallObjectMethod") + .asFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + )>(); + + /// from: public final java.io.Reader charStream() + /// The returned object must be released after use, by calling the [release] method. + jni.JObject charStream() { + return _charStream(reference.pointer, _id_charStream as jni.JMethodIDPtr) + .object(const jni.JObjectType()); + } + + static final _id_string = _class.instanceMethodId( + r"string", + r"()Ljava/lang/String;", + ); + + static final _string = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + )>>("globalEnv_CallObjectMethod") + .asFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + )>(); + + /// from: public final java.lang.String string() + /// The returned object must be released after use, by calling the [release] method. + jni.JString string() { + return _string(reference.pointer, _id_string as jni.JMethodIDPtr) + .object(const jni.JStringType()); + } + + static final _id_close = _class.instanceMethodId( + r"close", + r"()V", + ); + + static final _close = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JThrowablePtr Function( + ffi.Pointer, + jni.JMethodIDPtr, + )>>("globalEnv_CallVoidMethod") + .asFunction< + jni.JThrowablePtr Function( + ffi.Pointer, + jni.JMethodIDPtr, + )>(); + + /// from: public void close() + void close() { + _close(reference.pointer, _id_close as jni.JMethodIDPtr).check(); + } + + static final _id_create = _class.staticMethodId( + r"create", + r"(Ljava/lang/String;Lokhttp3/MediaType;)Lokhttp3/ResponseBody;", + ); + + static final _create = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + ffi.VarArgs< + ( + ffi.Pointer, + ffi.Pointer + )>)>>("globalEnv_CallStaticObjectMethod") + .asFunction< + jni.JniResult Function(ffi.Pointer, jni.JMethodIDPtr, + ffi.Pointer, ffi.Pointer)>(); + + /// from: static public final okhttp3.ResponseBody create(java.lang.String string, okhttp3.MediaType mediaType) + /// The returned object must be released after use, by calling the [release] method. + static ResponseBody create( + jni.JString string, + jni.JObject mediaType, + ) { + return _create(_class.reference.pointer, _id_create as jni.JMethodIDPtr, + string.reference.pointer, mediaType.reference.pointer) + .object(const $ResponseBodyType()); + } + + static final _id_create1 = _class.staticMethodId( + r"create", + r"([BLokhttp3/MediaType;)Lokhttp3/ResponseBody;", + ); + + static final _create1 = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + ffi.VarArgs< + ( + ffi.Pointer, + ffi.Pointer + )>)>>("globalEnv_CallStaticObjectMethod") + .asFunction< + jni.JniResult Function(ffi.Pointer, jni.JMethodIDPtr, + ffi.Pointer, ffi.Pointer)>(); + + /// from: static public final okhttp3.ResponseBody create(byte[] bs, okhttp3.MediaType mediaType) + /// The returned object must be released after use, by calling the [release] method. + static ResponseBody create1( + jni.JArray bs, + jni.JObject mediaType, + ) { + return _create1(_class.reference.pointer, _id_create1 as jni.JMethodIDPtr, + bs.reference.pointer, mediaType.reference.pointer) + .object(const $ResponseBodyType()); + } + + static final _id_create2 = _class.staticMethodId( + r"create", + r"(Lokio/ByteString;Lokhttp3/MediaType;)Lokhttp3/ResponseBody;", + ); + + static final _create2 = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + ffi.VarArgs< + ( + ffi.Pointer, + ffi.Pointer + )>)>>("globalEnv_CallStaticObjectMethod") + .asFunction< + jni.JniResult Function(ffi.Pointer, jni.JMethodIDPtr, + ffi.Pointer, ffi.Pointer)>(); + + /// from: static public final okhttp3.ResponseBody create(okio.ByteString byteString, okhttp3.MediaType mediaType) + /// The returned object must be released after use, by calling the [release] method. + static ResponseBody create2( + jni.JObject byteString, + jni.JObject mediaType, + ) { + return _create2(_class.reference.pointer, _id_create2 as jni.JMethodIDPtr, + byteString.reference.pointer, mediaType.reference.pointer) + .object(const $ResponseBodyType()); + } + + static final _id_create3 = _class.staticMethodId( + r"create", + r"(Lokio/BufferedSource;Lokhttp3/MediaType;J)Lokhttp3/ResponseBody;", + ); + + static final _create3 = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + ffi.VarArgs< + ( + ffi.Pointer, + ffi.Pointer, + ffi.Int64 + )>)>>("globalEnv_CallStaticObjectMethod") + .asFunction< + jni.JniResult Function(ffi.Pointer, jni.JMethodIDPtr, + ffi.Pointer, ffi.Pointer, int)>(); + + /// from: static public final okhttp3.ResponseBody create(okio.BufferedSource bufferedSource, okhttp3.MediaType mediaType, long j) + /// The returned object must be released after use, by calling the [release] method. + static ResponseBody create3( + jni.JObject bufferedSource, + jni.JObject mediaType, + int j, + ) { + return _create3(_class.reference.pointer, _id_create3 as jni.JMethodIDPtr, + bufferedSource.reference.pointer, mediaType.reference.pointer, j) + .object(const $ResponseBodyType()); + } + + static final _id_create4 = _class.staticMethodId( + r"create", + r"(Lokhttp3/MediaType;Ljava/lang/String;)Lokhttp3/ResponseBody;", + ); + + static final _create4 = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + ffi.VarArgs< + ( + ffi.Pointer, + ffi.Pointer + )>)>>("globalEnv_CallStaticObjectMethod") + .asFunction< + jni.JniResult Function(ffi.Pointer, jni.JMethodIDPtr, + ffi.Pointer, ffi.Pointer)>(); + + /// from: static public final okhttp3.ResponseBody create(okhttp3.MediaType mediaType, java.lang.String string) + /// The returned object must be released after use, by calling the [release] method. + static ResponseBody create4( + jni.JObject mediaType, + jni.JString string, + ) { + return _create4(_class.reference.pointer, _id_create4 as jni.JMethodIDPtr, + mediaType.reference.pointer, string.reference.pointer) + .object(const $ResponseBodyType()); + } + + static final _id_create5 = _class.staticMethodId( + r"create", + r"(Lokhttp3/MediaType;[B)Lokhttp3/ResponseBody;", + ); + + static final _create5 = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + ffi.VarArgs< + ( + ffi.Pointer, + ffi.Pointer + )>)>>("globalEnv_CallStaticObjectMethod") + .asFunction< + jni.JniResult Function(ffi.Pointer, jni.JMethodIDPtr, + ffi.Pointer, ffi.Pointer)>(); + + /// from: static public final okhttp3.ResponseBody create(okhttp3.MediaType mediaType, byte[] bs) + /// The returned object must be released after use, by calling the [release] method. + static ResponseBody create5( + jni.JObject mediaType, + jni.JArray bs, + ) { + return _create5(_class.reference.pointer, _id_create5 as jni.JMethodIDPtr, + mediaType.reference.pointer, bs.reference.pointer) + .object(const $ResponseBodyType()); + } + + static final _id_create6 = _class.staticMethodId( + r"create", + r"(Lokhttp3/MediaType;Lokio/ByteString;)Lokhttp3/ResponseBody;", + ); + + static final _create6 = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + ffi.VarArgs< + ( + ffi.Pointer, + ffi.Pointer + )>)>>("globalEnv_CallStaticObjectMethod") + .asFunction< + jni.JniResult Function(ffi.Pointer, jni.JMethodIDPtr, + ffi.Pointer, ffi.Pointer)>(); + + /// from: static public final okhttp3.ResponseBody create(okhttp3.MediaType mediaType, okio.ByteString byteString) + /// The returned object must be released after use, by calling the [release] method. + static ResponseBody create6( + jni.JObject mediaType, + jni.JObject byteString, + ) { + return _create6(_class.reference.pointer, _id_create6 as jni.JMethodIDPtr, + mediaType.reference.pointer, byteString.reference.pointer) + .object(const $ResponseBodyType()); + } + + static final _id_create7 = _class.staticMethodId( + r"create", + r"(Lokhttp3/MediaType;JLokio/BufferedSource;)Lokhttp3/ResponseBody;", + ); + + static final _create7 = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer, + jni.JMethodIDPtr, + ffi.VarArgs< + ( + ffi.Pointer, + ffi.Int64, + ffi.Pointer + )>)>>("globalEnv_CallStaticObjectMethod") + .asFunction< + jni.JniResult Function(ffi.Pointer, jni.JMethodIDPtr, + ffi.Pointer, int, ffi.Pointer)>(); + + /// from: static public final okhttp3.ResponseBody create(okhttp3.MediaType mediaType, long j, okio.BufferedSource bufferedSource) + /// The returned object must be released after use, by calling the [release] method. + static ResponseBody create7( + jni.JObject mediaType, + int j, + jni.JObject bufferedSource, + ) { + return _create7(_class.reference.pointer, _id_create7 as jni.JMethodIDPtr, + mediaType.reference.pointer, j, bufferedSource.reference.pointer) + .object(const $ResponseBodyType()); + } +} + +final class $ResponseBodyType extends jni.JObjType { + const $ResponseBodyType(); + + @override + String get signature => r"Lokhttp3/ResponseBody;"; + + @override + ResponseBody fromReference(jni.JReference reference) => + ResponseBody.fromReference(reference); + + @override + jni.JObjType get superType => const jni.JObjectType(); + + @override + final superCount = 1; + + @override + int get hashCode => ($ResponseBodyType).hashCode; + + @override + bool operator ==(Object other) { + return other.runtimeType == ($ResponseBodyType) && + other is $ResponseBodyType; + } +} diff --git a/pkgs/ok_http/lib/src/third_party/okhttp3/_package.dart b/pkgs/ok_http/lib/src/third_party/okhttp3/_package.dart new file mode 100644 index 0000000000..64124553ea --- /dev/null +++ b/pkgs/ok_http/lib/src/third_party/okhttp3/_package.dart @@ -0,0 +1,8 @@ +export "Request.dart"; +export "RequestBody.dart"; +export "Response.dart"; +export "ResponseBody.dart"; +export "OkHttpClient.dart"; +export "Call.dart"; +export "Headers.dart"; +export "Callback.dart"; diff --git a/pkgs/ok_http/pubspec.yaml b/pkgs/ok_http/pubspec.yaml index 2a7a21fc28..8b217d23d4 100644 --- a/pkgs/ok_http/pubspec.yaml +++ b/pkgs/ok_http/pubspec.yaml @@ -12,10 +12,13 @@ environment: dependencies: flutter: sdk: flutter + http: ^1.2.1 + jni: ^0.9.2 plugin_platform_interface: ^2.0.2 dev_dependencies: dart_flutter_team_lints: ^2.0.0 + jnigen: ^0.9.1 flutter: plugin: