[Dart] - Rework Dart client generator to be flutter-compatible (#7418)
* copy mustache templates from dart generator * Start with generator by copying the DartClientCodegen for now * at least we know this is not for a browser.. * First working version for a simple swagger configuration * remove browserClient parameter, since it doesn't make sense for flutter * Take care of complex types to support object hierarchies * add null safety * add small test for options * add flutter-petstore scripts * generate flutter petstore output * Add new flutter test project * move generated client to make it usable * use generated swagger petstore plugin * add support for lists of objects * add DateTime support * fix listFromJson implementation * fix NPEs in DateTime operations + place order in sample * Small readme changes * bugfixes * Use flutter-compatible implementation as default dart implementation * fix generated samples * Make lists serializable, now all dart test cases are working again * better list implementation * use StringBuffer * removed FlutterClientCodegen * fix browser client * fix dependencies * swagger-browser-client for browserClient testcases * fix scripts * removed flutter scripts * add map support and simplify code via using .toJson contract * remove unneeded devDependencies * Regenerated samples * fix call to mapFromJson, it is not a constructor * remove pointless string serialization * regenerated dart samples
@ -27,12 +27,21 @@ fi
|
||||
# if you've executed sbt assembly previously it will use that instead.
|
||||
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
|
||||
|
||||
ags="$@ generate -t modules/swagger-codegen/src/main/resources/dart -i modules/swagger-codegen/src/test/resources/2_0/petstore.yaml -l dart -o samples/client/petstore/dart/swagger -DhideGenerationTimestamp=true"
|
||||
# Generate non-browserClient
|
||||
ags="$@ generate -t modules/swagger-codegen/src/main/resources/dart -i modules/swagger-codegen/src/test/resources/2_0/petstore.yaml -l dart -o samples/client/petstore/dart/swagger -DhideGenerationTimestamp=true -DbrowserClient=false"
|
||||
|
||||
# then options to generate the library for vm would be:
|
||||
#ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/petstore.yaml -l dart -o samples/client/petstore/dart/swagger_vm -DbrowserClient=false -DpubName=swagger_vm"
|
||||
java $JAVA_OPTS -jar $executable $ags
|
||||
|
||||
# Generate browserClient
|
||||
ags="$@ generate -t modules/swagger-codegen/src/main/resources/dart -i modules/swagger-codegen/src/test/resources/2_0/petstore.yaml -l dart -o samples/client/petstore/dart/swagger-browser-client -DhideGenerationTimestamp=true -DbrowserClient=true"
|
||||
java $JAVA_OPTS -jar $executable $ags
|
||||
|
||||
# Generate non-browserClient and put it to the flutter sample app
|
||||
ags="$@ generate -t modules/swagger-codegen/src/main/resources/dart -i modules/swagger-codegen/src/test/resources/2_0/petstore.yaml -l dart -o samples/client/petstore/dart/flutter_petstore/swagger -DhideGenerationTimestamp=true -DbrowserClient=false"
|
||||
java $JAVA_OPTS -jar $executable $ags
|
||||
|
||||
# There is a proposal to allow importing different libraries depending on the environment:
|
||||
# https://github.com/munificent/dep-interface-libraries
|
||||
# When this is implemented there will only be one library.
|
||||
|
@ -5,6 +5,11 @@ If Not Exist %executable% (
|
||||
)
|
||||
|
||||
REM set JAVA_OPTS=%JAVA_OPTS% -Xmx1024M -DloggerPath=conf/log4j.properties
|
||||
set ags=generate -i modules\swagger-codegen\src\test\resources\2_0\petstore.yaml -l dart -o samples\client\petstore\dart
|
||||
|
||||
set ags=generate -i modules\swagger-codegen\src\test\resources\2_0\petstore.yaml -l dart -o samples\client\petstore\dart\swagger -DhideGenerationTimestamp=true -DbrowserClient=false
|
||||
java %JAVA_OPTS% -jar %executable% %ags%
|
||||
|
||||
set ags=generate -i modules\swagger-codegen\src\test\resources\2_0\petstore.yaml -l dart -o samples\client\petstore\dart\swagger-browser-client -DhideGenerationTimestamp=true -DbrowserClient=true
|
||||
java %JAVA_OPTS% -jar %executable% %ags%
|
||||
|
||||
set ags=generate -i modules\swagger-codegen\src\test\resources\2_0\petstore.yaml -l dart -o samples\client\petstore\dart\flutter_petstore\swagger -DhideGenerationTimestamp=true -DbrowserClient=false
|
||||
java %JAVA_OPTS% -jar %executable% %ags%
|
||||
|
@ -19,7 +19,7 @@ For more information, please visit [{{{infoUrl}}}]({{{infoUrl}}})
|
||||
|
||||
## Requirements
|
||||
|
||||
Dart 1.20.0 and later
|
||||
Dart 1.20.0 or later OR Flutter 0.0.20 or later
|
||||
|
||||
## Installation & Usage
|
||||
|
||||
|
@ -54,7 +54,7 @@ class {{classname}} {
|
||||
{{#formParams}}{{#notFile}}
|
||||
if ({{paramName}} != null) {
|
||||
hasFields = true;
|
||||
mp.fields['{{baseName}}'] = apiClient.parameterToString({{paramName}});
|
||||
mp.fields['{{baseName}}'] = parameterToString({{paramName}});
|
||||
}
|
||||
{{/notFile}}{{#isFile}}
|
||||
if ({{paramName}} != null) {
|
||||
@ -68,7 +68,7 @@ class {{classname}} {
|
||||
}
|
||||
else {
|
||||
{{#formParams}}{{#notFile}}if ({{paramName}} != null)
|
||||
formParams['{{baseName}}'] = apiClient.parameterToString({{paramName}});{{/notFile}}
|
||||
formParams['{{baseName}}'] = parameterToString({{paramName}});{{/notFile}}
|
||||
{{/formParams}}
|
||||
}
|
||||
|
||||
|
@ -15,16 +15,6 @@ class ApiClient {
|
||||
Map<String, String> _defaultHeaderMap = {};
|
||||
Map<String, Authentication> _authentications = {};
|
||||
|
||||
final dson = new Dartson.JSON()
|
||||
{{#models}}
|
||||
{{#model}}
|
||||
{{#isEnum}}
|
||||
..addTransformer(new {{classname}}TypeTransformer(), {{classname}})
|
||||
{{/isEnum}}
|
||||
{{/model}}
|
||||
{{/models}}
|
||||
..addTransformer(new DateTimeParser(), DateTime);
|
||||
|
||||
final _RegList = new RegExp(r'^List<(.*)>$');
|
||||
final _RegMap = new RegExp(r'^Map<String,(.*)>$');
|
||||
|
||||
@ -61,7 +51,7 @@ class ApiClient {
|
||||
return listResult[0];
|
||||
{{/isEnum}}
|
||||
{{^isEnum}}
|
||||
return dson.map(value, new {{classname}}());
|
||||
return new {{classname}}.fromJson(value);
|
||||
{{/isEnum}}
|
||||
{{/model}}
|
||||
{{/models}}
|
||||
@ -100,10 +90,8 @@ class ApiClient {
|
||||
String serialized = '';
|
||||
if (obj == null) {
|
||||
serialized = '';
|
||||
} else if (obj is String) {
|
||||
serialized = obj;
|
||||
} else {
|
||||
serialized = dson.encode(obj);
|
||||
serialized = JSON.encode(obj);
|
||||
}
|
||||
return serialized;
|
||||
}
|
||||
|
@ -11,7 +11,7 @@ Iterable<QueryParam> _convertParametersForCollectionFormat(
|
||||
if (name == null || name.isEmpty || value == null) return params;
|
||||
|
||||
if (value is! List) {
|
||||
params.add(new QueryParam(name, _parameterToString(value)));
|
||||
params.add(new QueryParam(name, parameterToString(value)));
|
||||
return params;
|
||||
}
|
||||
|
||||
@ -23,17 +23,17 @@ Iterable<QueryParam> _convertParametersForCollectionFormat(
|
||||
: collectionFormat; // default: csv
|
||||
|
||||
if (collectionFormat == "multi") {
|
||||
return values.map((v) => new QueryParam(name, _parameterToString(v)));
|
||||
return values.map((v) => new QueryParam(name, parameterToString(v)));
|
||||
}
|
||||
|
||||
String delimiter = _delimiters[collectionFormat] ?? ",";
|
||||
|
||||
params.add(new QueryParam(name, values.map((v)=>_parameterToString(v)).join(delimiter)));
|
||||
params.add(new QueryParam(name, values.map((v) => parameterToString(v)).join(delimiter)));
|
||||
return params;
|
||||
}
|
||||
|
||||
/// Format the given parameter object into string.
|
||||
String _parameterToString(dynamic value) {
|
||||
String parameterToString(dynamic value) {
|
||||
if (value == null) {
|
||||
return '';
|
||||
} else if (value is DateTime) {
|
||||
|
@ -4,9 +4,6 @@ import 'dart:async';
|
||||
import 'dart:convert';{{#browserClient}}
|
||||
import 'package:http/browser_client.dart';{{/browserClient}}
|
||||
import 'package:http/http.dart';
|
||||
import 'package:dartson/dartson.dart';
|
||||
import 'package:dartson/transformers/date_time.dart';
|
||||
import 'package:dartson/type_transformer.dart';
|
||||
|
||||
part 'api_client.dart';
|
||||
part 'api_helper.dart';
|
||||
|
@ -1,7 +1,5 @@
|
||||
@Entity()
|
||||
class {{classname}} {
|
||||
{{#vars}}{{#description}}/* {{{description}}} */{{/description}}
|
||||
@Property(name: '{{baseName}}')
|
||||
{{{datatype}}} {{name}} = {{{defaultValue}}};
|
||||
{{#allowableValues}}{{#min}} // range from {{min}} to {{max}}{{/min}}//{{^min}}enum {{name}}Enum { {{#values}} {{.}}, {{/values}} };{{/min}}{{/allowableValues}}
|
||||
{{/vars}}
|
||||
@ -11,4 +9,46 @@ class {{classname}} {
|
||||
String toString() {
|
||||
return '{{classname}}[{{#vars}}{{name}}=${{name}}, {{/vars}}]';
|
||||
}
|
||||
|
||||
{{classname}}.fromJson(Map<String, dynamic> json) {
|
||||
if (json == null) return;
|
||||
{{#vars}}
|
||||
{{#isDateTime}}
|
||||
{{name}} = json['{{name}}'] == null ? null : DateTime.parse(json['{{name}}']);
|
||||
{{/isDateTime}}
|
||||
{{^isDateTime}}
|
||||
{{name}} =
|
||||
{{#complexType}}
|
||||
{{#isListContainer}}{{complexType}}.listFromJson(json['{{name}}']){{/isListContainer}}{{^isListContainer}}
|
||||
{{#isMapContainer}}{{complexType}}.mapFromJson(json['{{name}}']){{/isMapContainer}}
|
||||
{{^isMapContainer}}new {{complexType}}.fromJson(json['{{name}}']){{/isMapContainer}}{{/isListContainer}}
|
||||
{{/complexType}}
|
||||
{{^complexType}}json['{{name}}']{{/complexType}};
|
||||
{{/isDateTime}}
|
||||
{{/vars}}
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
return {
|
||||
{{#vars}}
|
||||
{{#isDateTime}}'{{name}}': {{name}} == null ? '' : {{name}}.toUtc().toIso8601String(){{^-last}},{{/-last}}{{/isDateTime}}{{^isDateTime}}'{{name}}': {{name}}{{^-last}},{{/-last}}{{/isDateTime}}
|
||||
{{/vars}}
|
||||
};
|
||||
}
|
||||
|
||||
static List<{{classname}}> listFromJson(List<Map<String, dynamic>> json) {
|
||||
var list = new List<{{classname}}>();
|
||||
if (json != null && json.length > 0) {
|
||||
json.forEach((Map<String, dynamic> value) => list.add(new {{classname}}.fromJson(value)));
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
static Map<String, {{classname}}> mapFromJson(Map<String, Map<String, dynamic>> json) {
|
||||
var map = new Map<String, {{classname}}>();
|
||||
if (json != null && json.length > 0) {
|
||||
json.forEach((String key, Map<String, dynamic> value) => map[key] = new {{classname}}.fromJson(value));
|
||||
}
|
||||
return map;
|
||||
}
|
||||
}
|
||||
|
@ -3,11 +3,3 @@ version: {{pubVersion}}
|
||||
description: {{pubDescription}}
|
||||
dependencies:
|
||||
http: '>=0.11.1 <0.12.0'
|
||||
dartson: "^0.2.4"
|
||||
|
||||
dev_dependencies:
|
||||
guinness: '^0.1.17'
|
||||
browser: any
|
||||
|
||||
transformers:
|
||||
- dartson
|
||||
|
10
samples/client/petstore/dart/flutter_petstore/.gitignore
vendored
Normal file
@ -0,0 +1,10 @@
|
||||
.DS_Store
|
||||
.atom/
|
||||
.idea
|
||||
.packages
|
||||
.pub/
|
||||
build/
|
||||
ios/.generated/
|
||||
packages
|
||||
pubspec.lock
|
||||
.flutter-plugins
|
8
samples/client/petstore/dart/flutter_petstore/.metadata
Normal file
@ -0,0 +1,8 @@
|
||||
# This file tracks properties of this Flutter project.
|
||||
# Used by Flutter tool to assess capabilities and perform upgrades etc.
|
||||
#
|
||||
# This file should be version controlled and should not be manually edited.
|
||||
|
||||
version:
|
||||
revision: 8f65fec5f5f7d7afbb0965f4a44bdb330a28fb19
|
||||
channel: alpha
|
8
samples/client/petstore/dart/flutter_petstore/README.md
Normal file
@ -0,0 +1,8 @@
|
||||
# flutter_petstore
|
||||
|
||||
Swagger petstore sample flutter
|
||||
|
||||
## Getting Started
|
||||
|
||||
For help getting started with Flutter, view our online
|
||||
[documentation](http://flutter.io/).
|
9
samples/client/petstore/dart/flutter_petstore/android/.gitignore
vendored
Normal file
@ -0,0 +1,9 @@
|
||||
*.iml
|
||||
.gradle
|
||||
/local.properties
|
||||
/.idea/workspace.xml
|
||||
/.idea/libraries
|
||||
.DS_Store
|
||||
/build
|
||||
/captures
|
||||
GeneratedPluginRegistrant.java
|
@ -0,0 +1,52 @@
|
||||
def localProperties = new Properties()
|
||||
def localPropertiesFile = rootProject.file('local.properties')
|
||||
if (localPropertiesFile.exists()) {
|
||||
localPropertiesFile.withInputStream { stream ->
|
||||
localProperties.load(stream)
|
||||
}
|
||||
}
|
||||
|
||||
def flutterRoot = localProperties.getProperty('flutter.sdk')
|
||||
if (flutterRoot == null) {
|
||||
throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
|
||||
}
|
||||
|
||||
apply plugin: 'com.android.application'
|
||||
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
|
||||
|
||||
android {
|
||||
compileSdkVersion 25
|
||||
buildToolsVersion '25.0.3'
|
||||
|
||||
lintOptions {
|
||||
disable 'InvalidPackage'
|
||||
}
|
||||
|
||||
defaultConfig {
|
||||
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
|
||||
applicationId "com.yourcompany.flutterpetstore"
|
||||
minSdkVersion 16
|
||||
targetSdkVersion 25
|
||||
versionCode 1
|
||||
versionName "1.0"
|
||||
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
release {
|
||||
// TODO: Add your own signing config for the release build.
|
||||
// Signing with the debug keys for now, so `flutter run --release` works.
|
||||
signingConfig signingConfigs.debug
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
flutter {
|
||||
source '../..'
|
||||
}
|
||||
|
||||
dependencies {
|
||||
androidTestCompile 'com.android.support:support-annotations:25.4.0'
|
||||
androidTestCompile 'com.android.support.test:runner:0.5'
|
||||
androidTestCompile 'com.android.support.test:rules:0.5'
|
||||
}
|
@ -0,0 +1,39 @@
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.yourcompany.flutterpetstore">
|
||||
|
||||
<!-- The INTERNET permission is required for development. Specifically,
|
||||
flutter needs it to communicate with the running application
|
||||
to allow setting breakpoints, to provide hot reload, etc.
|
||||
-->
|
||||
<uses-permission android:name="android.permission.INTERNET"/>
|
||||
|
||||
<!-- io.flutter.app.FlutterApplication is an android.app.Application that
|
||||
calls FlutterMain.startInitialization(this); in its onCreate method.
|
||||
In most cases you can leave this as-is, but you if you want to provide
|
||||
additional functionality it is fine to subclass or reimplement
|
||||
FlutterApplication and put your custom class here. -->
|
||||
<application
|
||||
android:name="io.flutter.app.FlutterApplication"
|
||||
android:label="flutter_petstore"
|
||||
android:icon="@mipmap/ic_launcher">
|
||||
<activity
|
||||
android:name=".MainActivity"
|
||||
android:launchMode="singleTop"
|
||||
android:theme="@style/LaunchTheme"
|
||||
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|layoutDirection|fontScale"
|
||||
android:hardwareAccelerated="true"
|
||||
android:windowSoftInputMode="adjustResize">
|
||||
<!-- This keeps the window background of the activity showing
|
||||
until Flutter renders its first frame. It can be removed if
|
||||
there is no splash screen (such as the default splash screen
|
||||
defined in @style/LaunchTheme). -->
|
||||
<meta-data
|
||||
android:name="io.flutter.app.android.SplashScreenUntilFirstFrame"
|
||||
android:value="true" />
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN"/>
|
||||
<category android:name="android.intent.category.LAUNCHER"/>
|
||||
</intent-filter>
|
||||
</activity>
|
||||
</application>
|
||||
</manifest>
|
@ -0,0 +1,14 @@
|
||||
package com.yourcompany.flutterpetstore;
|
||||
|
||||
import android.os.Bundle;
|
||||
|
||||
import io.flutter.app.FlutterActivity;
|
||||
import io.flutter.plugins.GeneratedPluginRegistrant;
|
||||
|
||||
public class MainActivity extends FlutterActivity {
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
GeneratedPluginRegistrant.registerWith(this);
|
||||
}
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Modify this file to customize your launch splash screen -->
|
||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:drawable="@android:color/white" />
|
||||
|
||||
<!-- You can insert your own image assets here -->
|
||||
<!-- <item>
|
||||
<bitmap
|
||||
android:gravity="center"
|
||||
android:src="@mipmap/launch_image" />
|
||||
</item> -->
|
||||
</layer-list>
|
After Width: | Height: | Size: 544 B |
After Width: | Height: | Size: 442 B |
After Width: | Height: | Size: 721 B |
After Width: | Height: | Size: 1.0 KiB |
After Width: | Height: | Size: 1.4 KiB |
@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<style name="LaunchTheme" parent="@android:style/Theme.Black.NoTitleBar">
|
||||
<!-- Show a splash screen on the activity. Automatically removed when
|
||||
Flutter draws its first frame -->
|
||||
<item name="android:windowBackground">@drawable/launch_background</item>
|
||||
</style>
|
||||
</resources>
|
@ -0,0 +1,31 @@
|
||||
buildscript {
|
||||
repositories {
|
||||
jcenter()
|
||||
maven {
|
||||
url "https://maven.google.com"
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:2.3.3'
|
||||
}
|
||||
}
|
||||
|
||||
allprojects {
|
||||
repositories {
|
||||
jcenter()
|
||||
maven {
|
||||
url "https://maven.google.com"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
rootProject.buildDir = '../build'
|
||||
subprojects {
|
||||
project.buildDir = "${rootProject.buildDir}/${project.name}"
|
||||
project.evaluationDependsOn(':app')
|
||||
}
|
||||
|
||||
task clean(type: Delete) {
|
||||
delete rootProject.buildDir
|
||||
}
|
@ -0,0 +1 @@
|
||||
org.gradle.jvmargs=-Xmx1536M
|
BIN
samples/client/petstore/dart/flutter_petstore/android/gradle/wrapper/gradle-wrapper.jar
vendored
Normal file
@ -0,0 +1,6 @@
|
||||
#Fri Jun 23 08:50:38 CEST 2017
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip
|
160
samples/client/petstore/dart/flutter_petstore/android/gradlew
vendored
Executable file
@ -0,0 +1,160 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
##############################################################################
|
||||
##
|
||||
## Gradle start up script for UN*X
|
||||
##
|
||||
##############################################################################
|
||||
|
||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
DEFAULT_JVM_OPTS=""
|
||||
|
||||
APP_NAME="Gradle"
|
||||
APP_BASE_NAME=`basename "$0"`
|
||||
|
||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||
MAX_FD="maximum"
|
||||
|
||||
warn ( ) {
|
||||
echo "$*"
|
||||
}
|
||||
|
||||
die ( ) {
|
||||
echo
|
||||
echo "$*"
|
||||
echo
|
||||
exit 1
|
||||
}
|
||||
|
||||
# OS specific support (must be 'true' or 'false').
|
||||
cygwin=false
|
||||
msys=false
|
||||
darwin=false
|
||||
case "`uname`" in
|
||||
CYGWIN* )
|
||||
cygwin=true
|
||||
;;
|
||||
Darwin* )
|
||||
darwin=true
|
||||
;;
|
||||
MINGW* )
|
||||
msys=true
|
||||
;;
|
||||
esac
|
||||
|
||||
# Attempt to set APP_HOME
|
||||
# Resolve links: $0 may be a link
|
||||
PRG="$0"
|
||||
# Need this for relative symlinks.
|
||||
while [ -h "$PRG" ] ; do
|
||||
ls=`ls -ld "$PRG"`
|
||||
link=`expr "$ls" : '.*-> \(.*\)$'`
|
||||
if expr "$link" : '/.*' > /dev/null; then
|
||||
PRG="$link"
|
||||
else
|
||||
PRG=`dirname "$PRG"`"/$link"
|
||||
fi
|
||||
done
|
||||
SAVED="`pwd`"
|
||||
cd "`dirname \"$PRG\"`/" >/dev/null
|
||||
APP_HOME="`pwd -P`"
|
||||
cd "$SAVED" >/dev/null
|
||||
|
||||
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||
|
||||
# Determine the Java command to use to start the JVM.
|
||||
if [ -n "$JAVA_HOME" ] ; then
|
||||
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
||||
# IBM's JDK on AIX uses strange locations for the executables
|
||||
JAVACMD="$JAVA_HOME/jre/sh/java"
|
||||
else
|
||||
JAVACMD="$JAVA_HOME/bin/java"
|
||||
fi
|
||||
if [ ! -x "$JAVACMD" ] ; then
|
||||
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
else
|
||||
JAVACMD="java"
|
||||
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
|
||||
# Increase the maximum file descriptors if we can.
|
||||
if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
|
||||
MAX_FD_LIMIT=`ulimit -H -n`
|
||||
if [ $? -eq 0 ] ; then
|
||||
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
|
||||
MAX_FD="$MAX_FD_LIMIT"
|
||||
fi
|
||||
ulimit -n $MAX_FD
|
||||
if [ $? -ne 0 ] ; then
|
||||
warn "Could not set maximum file descriptor limit: $MAX_FD"
|
||||
fi
|
||||
else
|
||||
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
|
||||
fi
|
||||
fi
|
||||
|
||||
# For Darwin, add options to specify how the application appears in the dock
|
||||
if $darwin; then
|
||||
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
|
||||
fi
|
||||
|
||||
# For Cygwin, switch paths to Windows format before running java
|
||||
if $cygwin ; then
|
||||
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
|
||||
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
|
||||
JAVACMD=`cygpath --unix "$JAVACMD"`
|
||||
|
||||
# We build the pattern for arguments to be converted via cygpath
|
||||
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
|
||||
SEP=""
|
||||
for dir in $ROOTDIRSRAW ; do
|
||||
ROOTDIRS="$ROOTDIRS$SEP$dir"
|
||||
SEP="|"
|
||||
done
|
||||
OURCYGPATTERN="(^($ROOTDIRS))"
|
||||
# Add a user-defined pattern to the cygpath arguments
|
||||
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
|
||||
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
|
||||
fi
|
||||
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
||||
i=0
|
||||
for arg in "$@" ; do
|
||||
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
|
||||
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
|
||||
|
||||
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
|
||||
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
|
||||
else
|
||||
eval `echo args$i`="\"$arg\""
|
||||
fi
|
||||
i=$((i+1))
|
||||
done
|
||||
case $i in
|
||||
(0) set -- ;;
|
||||
(1) set -- "$args0" ;;
|
||||
(2) set -- "$args0" "$args1" ;;
|
||||
(3) set -- "$args0" "$args1" "$args2" ;;
|
||||
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
|
||||
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
|
||||
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
|
||||
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
|
||||
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
|
||||
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
|
||||
esac
|
||||
fi
|
||||
|
||||
# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
|
||||
function splitJvmOpts() {
|
||||
JVM_OPTS=("$@")
|
||||
}
|
||||
eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
|
||||
JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
|
||||
|
||||
exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
|
90
samples/client/petstore/dart/flutter_petstore/android/gradlew.bat
vendored
Normal file
@ -0,0 +1,90 @@
|
||||
@if "%DEBUG%" == "" @echo off
|
||||
@rem ##########################################################################
|
||||
@rem
|
||||
@rem Gradle startup script for Windows
|
||||
@rem
|
||||
@rem ##########################################################################
|
||||
|
||||
@rem Set local scope for the variables with windows NT shell
|
||||
if "%OS%"=="Windows_NT" setlocal
|
||||
|
||||
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
set DEFAULT_JVM_OPTS=
|
||||
|
||||
set DIRNAME=%~dp0
|
||||
if "%DIRNAME%" == "" set DIRNAME=.
|
||||
set APP_BASE_NAME=%~n0
|
||||
set APP_HOME=%DIRNAME%
|
||||
|
||||
@rem Find java.exe
|
||||
if defined JAVA_HOME goto findJavaFromJavaHome
|
||||
|
||||
set JAVA_EXE=java.exe
|
||||
%JAVA_EXE% -version >NUL 2>&1
|
||||
if "%ERRORLEVEL%" == "0" goto init
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
|
||||
goto fail
|
||||
|
||||
:findJavaFromJavaHome
|
||||
set JAVA_HOME=%JAVA_HOME:"=%
|
||||
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||
|
||||
if exist "%JAVA_EXE%" goto init
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
|
||||
goto fail
|
||||
|
||||
:init
|
||||
@rem Get command-line arguments, handling Windowz variants
|
||||
|
||||
if not "%OS%" == "Windows_NT" goto win9xME_args
|
||||
if "%@eval[2+2]" == "4" goto 4NT_args
|
||||
|
||||
:win9xME_args
|
||||
@rem Slurp the command line arguments.
|
||||
set CMD_LINE_ARGS=
|
||||
set _SKIP=2
|
||||
|
||||
:win9xME_args_slurp
|
||||
if "x%~1" == "x" goto execute
|
||||
|
||||
set CMD_LINE_ARGS=%*
|
||||
goto execute
|
||||
|
||||
:4NT_args
|
||||
@rem Get arguments from the 4NT Shell from JP Software
|
||||
set CMD_LINE_ARGS=%$
|
||||
|
||||
:execute
|
||||
@rem Setup the command line
|
||||
|
||||
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
||||
|
||||
@rem Execute Gradle
|
||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
|
||||
|
||||
:end
|
||||
@rem End local scope for the variables with windows NT shell
|
||||
if "%ERRORLEVEL%"=="0" goto mainEnd
|
||||
|
||||
:fail
|
||||
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
||||
rem the _cmd.exe /c_ return code!
|
||||
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
|
||||
exit /b 1
|
||||
|
||||
:mainEnd
|
||||
if "%OS%"=="Windows_NT" endlocal
|
||||
|
||||
:omega
|
@ -0,0 +1,15 @@
|
||||
include ':app'
|
||||
|
||||
def flutterProjectRoot = rootProject.projectDir.parentFile.toPath()
|
||||
|
||||
def plugins = new Properties()
|
||||
def pluginsFile = new File(flutterProjectRoot.toFile(), '.flutter-plugins')
|
||||
if (pluginsFile.exists()) {
|
||||
pluginsFile.withInputStream { stream -> plugins.load(stream) }
|
||||
}
|
||||
|
||||
plugins.each { name, path ->
|
||||
def pluginDirectory = flutterProjectRoot.resolve(path).resolve('android').toFile()
|
||||
include ":$name"
|
||||
project(":$name").projectDir = pluginDirectory
|
||||
}
|
41
samples/client/petstore/dart/flutter_petstore/ios/.gitignore
vendored
Normal file
@ -0,0 +1,41 @@
|
||||
.idea/
|
||||
.vagrant/
|
||||
.sconsign.dblite
|
||||
.svn/
|
||||
|
||||
.DS_Store
|
||||
*.swp
|
||||
profile
|
||||
|
||||
DerivedData/
|
||||
build/
|
||||
GeneratedPluginRegistrant.h
|
||||
GeneratedPluginRegistrant.m
|
||||
|
||||
*.pbxuser
|
||||
*.mode1v3
|
||||
*.mode2v3
|
||||
*.perspectivev3
|
||||
|
||||
!default.pbxuser
|
||||
!default.mode1v3
|
||||
!default.mode2v3
|
||||
!default.perspectivev3
|
||||
|
||||
xcuserdata
|
||||
|
||||
*.moved-aside
|
||||
|
||||
*.pyc
|
||||
*sync/
|
||||
Icon?
|
||||
.tags*
|
||||
|
||||
/Flutter/app.flx
|
||||
/Flutter/app.zip
|
||||
/Flutter/App.framework
|
||||
/Flutter/Flutter.framework
|
||||
/Flutter/Generated.xcconfig
|
||||
/ServiceDefinitions.json
|
||||
|
||||
Pods/
|
@ -0,0 +1,30 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>en</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>App</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>io.flutter.flutter.app</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>App</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>FMWK</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.0</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>1.0</string>
|
||||
<key>UIRequiredDeviceCapabilities</key>
|
||||
<array>
|
||||
<string>arm64</string>
|
||||
</array>
|
||||
<key>MinimumOSVersion</key>
|
||||
<string>8.0</string>
|
||||
</dict>
|
||||
</plist>
|
@ -0,0 +1 @@
|
||||
#include "Generated.xcconfig"
|
@ -0,0 +1 @@
|
||||
#include "Generated.xcconfig"
|
@ -0,0 +1,436 @@
|
||||
// !$*UTF8*$!
|
||||
{
|
||||
archiveVersion = 1;
|
||||
classes = {
|
||||
};
|
||||
objectVersion = 46;
|
||||
objects = {
|
||||
|
||||
/* Begin PBXBuildFile section */
|
||||
1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; };
|
||||
3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; };
|
||||
3B80C3941E831B6300D905FE /* App.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3B80C3931E831B6300D905FE /* App.framework */; };
|
||||
3B80C3951E831B6300D905FE /* App.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 3B80C3931E831B6300D905FE /* App.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
|
||||
9705A1C61CF904A100538489 /* Flutter.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9740EEBA1CF902C7004384FC /* Flutter.framework */; };
|
||||
9705A1C71CF904A300538489 /* Flutter.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 9740EEBA1CF902C7004384FC /* Flutter.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
|
||||
9740EEB41CF90195004384FC /* Debug.xcconfig in Resources */ = {isa = PBXBuildFile; fileRef = 9740EEB21CF90195004384FC /* Debug.xcconfig */; };
|
||||
9740EEB51CF90195004384FC /* Generated.xcconfig in Resources */ = {isa = PBXBuildFile; fileRef = 9740EEB31CF90195004384FC /* Generated.xcconfig */; };
|
||||
9740EEBB1CF902C7004384FC /* app.flx in Resources */ = {isa = PBXBuildFile; fileRef = 9740EEB71CF902C7004384FC /* app.flx */; };
|
||||
978B8F6F1D3862AE00F588F7 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */; };
|
||||
97C146F31CF9000F007C117D /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 97C146F21CF9000F007C117D /* main.m */; };
|
||||
97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; };
|
||||
97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; };
|
||||
97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; };
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
/* Begin PBXCopyFilesBuildPhase section */
|
||||
9705A1C41CF9048500538489 /* Embed Frameworks */ = {
|
||||
isa = PBXCopyFilesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
dstPath = "";
|
||||
dstSubfolderSpec = 10;
|
||||
files = (
|
||||
3B80C3951E831B6300D905FE /* App.framework in Embed Frameworks */,
|
||||
9705A1C71CF904A300538489 /* Flutter.framework in Embed Frameworks */,
|
||||
);
|
||||
name = "Embed Frameworks";
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXCopyFilesBuildPhase section */
|
||||
|
||||
/* Begin PBXFileReference section */
|
||||
1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = "<group>"; };
|
||||
1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = "<group>"; };
|
||||
3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = "<group>"; };
|
||||
3B80C3931E831B6300D905FE /* App.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = App.framework; path = Flutter/App.framework; sourceTree = "<group>"; };
|
||||
7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = "<group>"; };
|
||||
7AFFD8ED1D35381100E5BB4D /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = "<group>"; };
|
||||
7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = "<group>"; };
|
||||
9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = "<group>"; };
|
||||
9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = "<group>"; };
|
||||
9740EEB71CF902C7004384FC /* app.flx */ = {isa = PBXFileReference; lastKnownFileType = file; name = app.flx; path = Flutter/app.flx; sourceTree = "<group>"; };
|
||||
9740EEBA1CF902C7004384FC /* Flutter.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Flutter.framework; path = Flutter/Flutter.framework; sourceTree = "<group>"; };
|
||||
97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
97C146F21CF9000F007C117D /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
|
||||
97C146FB1CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; };
|
||||
97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
|
||||
97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
|
||||
97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
||||
/* End PBXFileReference section */
|
||||
|
||||
/* Begin PBXFrameworksBuildPhase section */
|
||||
97C146EB1CF9000F007C117D /* Frameworks */ = {
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
9705A1C61CF904A100538489 /* Flutter.framework in Frameworks */,
|
||||
3B80C3941E831B6300D905FE /* App.framework in Frameworks */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXFrameworksBuildPhase section */
|
||||
|
||||
/* Begin PBXGroup section */
|
||||
9740EEB11CF90186004384FC /* Flutter */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
9740EEB71CF902C7004384FC /* app.flx */,
|
||||
3B80C3931E831B6300D905FE /* App.framework */,
|
||||
3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */,
|
||||
9740EEBA1CF902C7004384FC /* Flutter.framework */,
|
||||
9740EEB21CF90195004384FC /* Debug.xcconfig */,
|
||||
7AFA3C8E1D35360C0083082E /* Release.xcconfig */,
|
||||
9740EEB31CF90195004384FC /* Generated.xcconfig */,
|
||||
);
|
||||
name = Flutter;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
97C146E51CF9000F007C117D = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
9740EEB11CF90186004384FC /* Flutter */,
|
||||
97C146F01CF9000F007C117D /* Runner */,
|
||||
97C146EF1CF9000F007C117D /* Products */,
|
||||
CF3B75C9A7D2FA2A4C99F110 /* Frameworks */,
|
||||
);
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
97C146EF1CF9000F007C117D /* Products */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
97C146EE1CF9000F007C117D /* Runner.app */,
|
||||
);
|
||||
name = Products;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
97C146F01CF9000F007C117D /* Runner */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
7AFFD8ED1D35381100E5BB4D /* AppDelegate.h */,
|
||||
7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */,
|
||||
97C146FA1CF9000F007C117D /* Main.storyboard */,
|
||||
97C146FD1CF9000F007C117D /* Assets.xcassets */,
|
||||
97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */,
|
||||
97C147021CF9000F007C117D /* Info.plist */,
|
||||
97C146F11CF9000F007C117D /* Supporting Files */,
|
||||
1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */,
|
||||
1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */,
|
||||
);
|
||||
path = Runner;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
97C146F11CF9000F007C117D /* Supporting Files */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
97C146F21CF9000F007C117D /* main.m */,
|
||||
);
|
||||
name = "Supporting Files";
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
/* End PBXGroup section */
|
||||
|
||||
/* Begin PBXNativeTarget section */
|
||||
97C146ED1CF9000F007C117D /* Runner */ = {
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */;
|
||||
buildPhases = (
|
||||
9740EEB61CF901F6004384FC /* Run Script */,
|
||||
97C146EA1CF9000F007C117D /* Sources */,
|
||||
97C146EB1CF9000F007C117D /* Frameworks */,
|
||||
97C146EC1CF9000F007C117D /* Resources */,
|
||||
9705A1C41CF9048500538489 /* Embed Frameworks */,
|
||||
3B06AD1E1E4923F5004D2608 /* Thin Binary */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
dependencies = (
|
||||
);
|
||||
name = Runner;
|
||||
productName = Runner;
|
||||
productReference = 97C146EE1CF9000F007C117D /* Runner.app */;
|
||||
productType = "com.apple.product-type.application";
|
||||
};
|
||||
/* End PBXNativeTarget section */
|
||||
|
||||
/* Begin PBXProject section */
|
||||
97C146E61CF9000F007C117D /* Project object */ = {
|
||||
isa = PBXProject;
|
||||
attributes = {
|
||||
LastUpgradeCheck = 0910;
|
||||
ORGANIZATIONNAME = "The Chromium Authors";
|
||||
TargetAttributes = {
|
||||
97C146ED1CF9000F007C117D = {
|
||||
CreatedOnToolsVersion = 7.3.1;
|
||||
};
|
||||
};
|
||||
};
|
||||
buildConfigurationList = 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */;
|
||||
compatibilityVersion = "Xcode 3.2";
|
||||
developmentRegion = English;
|
||||
hasScannedForEncodings = 0;
|
||||
knownRegions = (
|
||||
en,
|
||||
Base,
|
||||
);
|
||||
mainGroup = 97C146E51CF9000F007C117D;
|
||||
productRefGroup = 97C146EF1CF9000F007C117D /* Products */;
|
||||
projectDirPath = "";
|
||||
projectRoot = "";
|
||||
targets = (
|
||||
97C146ED1CF9000F007C117D /* Runner */,
|
||||
);
|
||||
};
|
||||
/* End PBXProject section */
|
||||
|
||||
/* Begin PBXResourcesBuildPhase section */
|
||||
97C146EC1CF9000F007C117D /* Resources */ = {
|
||||
isa = PBXResourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
9740EEBB1CF902C7004384FC /* app.flx in Resources */,
|
||||
97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */,
|
||||
9740EEB51CF90195004384FC /* Generated.xcconfig in Resources */,
|
||||
3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */,
|
||||
9740EEB41CF90195004384FC /* Debug.xcconfig in Resources */,
|
||||
97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */,
|
||||
97C146FC1CF9000F007C117D /* Main.storyboard in Resources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXResourcesBuildPhase section */
|
||||
|
||||
/* Begin PBXShellScriptBuildPhase section */
|
||||
3B06AD1E1E4923F5004D2608 /* Thin Binary */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
inputPaths = (
|
||||
);
|
||||
name = "Thin Binary";
|
||||
outputPaths = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" thin";
|
||||
};
|
||||
9740EEB61CF901F6004384FC /* Run Script */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
inputPaths = (
|
||||
);
|
||||
name = "Run Script";
|
||||
outputPaths = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build";
|
||||
};
|
||||
/* End PBXShellScriptBuildPhase section */
|
||||
|
||||
/* Begin PBXSourcesBuildPhase section */
|
||||
97C146EA1CF9000F007C117D /* Sources */ = {
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
978B8F6F1D3862AE00F588F7 /* AppDelegate.m in Sources */,
|
||||
97C146F31CF9000F007C117D /* main.m in Sources */,
|
||||
1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXSourcesBuildPhase section */
|
||||
|
||||
/* Begin PBXVariantGroup section */
|
||||
97C146FA1CF9000F007C117D /* Main.storyboard */ = {
|
||||
isa = PBXVariantGroup;
|
||||
children = (
|
||||
97C146FB1CF9000F007C117D /* Base */,
|
||||
);
|
||||
name = Main.storyboard;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */ = {
|
||||
isa = PBXVariantGroup;
|
||||
children = (
|
||||
97C147001CF9000F007C117D /* Base */,
|
||||
);
|
||||
name = LaunchScreen.storyboard;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
/* End PBXVariantGroup section */
|
||||
|
||||
/* Begin XCBuildConfiguration section */
|
||||
97C147031CF9000F007C117D /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
CLANG_ANALYZER_NONNULL = YES;
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
|
||||
CLANG_CXX_LIBRARY = "libc++";
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CLANG_ENABLE_OBJC_ARC = YES;
|
||||
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
|
||||
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||
CLANG_WARN_COMMA = YES;
|
||||
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||
CLANG_WARN_EMPTY_BODY = YES;
|
||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||
CLANG_WARN_INFINITE_RECURSION = YES;
|
||||
CLANG_WARN_INT_CONVERSION = YES;
|
||||
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
|
||||
CLANG_WARN_STRICT_PROTOTYPES = YES;
|
||||
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
||||
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
|
||||
COPY_PHASE_STRIP = NO;
|
||||
DEBUG_INFORMATION_FORMAT = dwarf;
|
||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||
ENABLE_TESTABILITY = YES;
|
||||
GCC_C_LANGUAGE_STANDARD = gnu99;
|
||||
GCC_DYNAMIC_NO_PIC = NO;
|
||||
GCC_NO_COMMON_BLOCKS = YES;
|
||||
GCC_OPTIMIZATION_LEVEL = 0;
|
||||
GCC_PREPROCESSOR_DEFINITIONS = (
|
||||
"DEBUG=1",
|
||||
"$(inherited)",
|
||||
);
|
||||
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
|
||||
GCC_WARN_UNDECLARED_SELECTOR = YES;
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
|
||||
MTL_ENABLE_DEBUG_INFO = YES;
|
||||
ONLY_ACTIVE_ARCH = YES;
|
||||
SDKROOT = iphoneos;
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
97C147041CF9000F007C117D /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
CLANG_ANALYZER_NONNULL = YES;
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
|
||||
CLANG_CXX_LIBRARY = "libc++";
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CLANG_ENABLE_OBJC_ARC = YES;
|
||||
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
|
||||
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||
CLANG_WARN_COMMA = YES;
|
||||
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||
CLANG_WARN_EMPTY_BODY = YES;
|
||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||
CLANG_WARN_INFINITE_RECURSION = YES;
|
||||
CLANG_WARN_INT_CONVERSION = YES;
|
||||
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
|
||||
CLANG_WARN_STRICT_PROTOTYPES = YES;
|
||||
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
||||
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
|
||||
COPY_PHASE_STRIP = NO;
|
||||
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
||||
ENABLE_NS_ASSERTIONS = NO;
|
||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||
GCC_C_LANGUAGE_STANDARD = gnu99;
|
||||
GCC_NO_COMMON_BLOCKS = YES;
|
||||
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
|
||||
GCC_WARN_UNDECLARED_SELECTOR = YES;
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
|
||||
MTL_ENABLE_DEBUG_INFO = NO;
|
||||
SDKROOT = iphoneos;
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
VALIDATE_PRODUCT = YES;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
97C147061CF9000F007C117D /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */;
|
||||
buildSettings = {
|
||||
ARCHS = arm64;
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
ENABLE_BITCODE = NO;
|
||||
FRAMEWORK_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"$(PROJECT_DIR)/Flutter",
|
||||
);
|
||||
INFOPLIST_FILE = Runner/Info.plist;
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
|
||||
LIBRARY_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"$(PROJECT_DIR)/Flutter",
|
||||
);
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.yourcompany.flutterPetstore;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
97C147071CF9000F007C117D /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */;
|
||||
buildSettings = {
|
||||
ARCHS = arm64;
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
ENABLE_BITCODE = NO;
|
||||
FRAMEWORK_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"$(PROJECT_DIR)/Flutter",
|
||||
);
|
||||
INFOPLIST_FILE = Runner/Info.plist;
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
|
||||
LIBRARY_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"$(PROJECT_DIR)/Flutter",
|
||||
);
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.yourcompany.flutterPetstore;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
/* End XCBuildConfiguration section */
|
||||
|
||||
/* Begin XCConfigurationList section */
|
||||
97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
97C147031CF9000F007C117D /* Debug */,
|
||||
97C147041CF9000F007C117D /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
97C147061CF9000F007C117D /* Debug */,
|
||||
97C147071CF9000F007C117D /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
/* End XCConfigurationList section */
|
||||
};
|
||||
rootObject = 97C146E61CF9000F007C117D /* Project object */;
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Workspace
|
||||
version = "1.0">
|
||||
<FileRef
|
||||
location = "group:Runner.xcodeproj">
|
||||
</FileRef>
|
||||
</Workspace>
|
@ -0,0 +1,93 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "0910"
|
||||
version = "1.3">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
buildImplicitDependencies = "YES">
|
||||
<BuildActionEntries>
|
||||
<BuildActionEntry
|
||||
buildForTesting = "YES"
|
||||
buildForRunning = "YES"
|
||||
buildForProfiling = "YES"
|
||||
buildForArchiving = "YES"
|
||||
buildForAnalyzing = "YES">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "97C146ED1CF9000F007C117D"
|
||||
BuildableName = "Runner.app"
|
||||
BlueprintName = "Runner"
|
||||
ReferencedContainer = "container:Runner.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildActionEntry>
|
||||
</BuildActionEntries>
|
||||
</BuildAction>
|
||||
<TestAction
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
language = ""
|
||||
shouldUseLaunchSchemeArgsEnv = "YES">
|
||||
<Testables>
|
||||
</Testables>
|
||||
<MacroExpansion>
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "97C146ED1CF9000F007C117D"
|
||||
BuildableName = "Runner.app"
|
||||
BlueprintName = "Runner"
|
||||
ReferencedContainer = "container:Runner.xcodeproj">
|
||||
</BuildableReference>
|
||||
</MacroExpansion>
|
||||
<AdditionalOptions>
|
||||
</AdditionalOptions>
|
||||
</TestAction>
|
||||
<LaunchAction
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
language = ""
|
||||
launchStyle = "0"
|
||||
useCustomWorkingDirectory = "NO"
|
||||
ignoresPersistentStateOnLaunch = "NO"
|
||||
debugDocumentVersioning = "YES"
|
||||
debugServiceExtension = "internal"
|
||||
allowLocationSimulation = "YES">
|
||||
<BuildableProductRunnable
|
||||
runnableDebuggingMode = "0">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "97C146ED1CF9000F007C117D"
|
||||
BuildableName = "Runner.app"
|
||||
BlueprintName = "Runner"
|
||||
ReferencedContainer = "container:Runner.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildableProductRunnable>
|
||||
<AdditionalOptions>
|
||||
</AdditionalOptions>
|
||||
</LaunchAction>
|
||||
<ProfileAction
|
||||
buildConfiguration = "Release"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES"
|
||||
savedToolIdentifier = ""
|
||||
useCustomWorkingDirectory = "NO"
|
||||
debugDocumentVersioning = "YES">
|
||||
<BuildableProductRunnable
|
||||
runnableDebuggingMode = "0">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "97C146ED1CF9000F007C117D"
|
||||
BuildableName = "Runner.app"
|
||||
BlueprintName = "Runner"
|
||||
ReferencedContainer = "container:Runner.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildableProductRunnable>
|
||||
</ProfileAction>
|
||||
<AnalyzeAction
|
||||
buildConfiguration = "Debug">
|
||||
</AnalyzeAction>
|
||||
<ArchiveAction
|
||||
buildConfiguration = "Release"
|
||||
revealArchiveInOrganizer = "YES">
|
||||
</ArchiveAction>
|
||||
</Scheme>
|
7
samples/client/petstore/dart/flutter_petstore/ios/Runner.xcworkspace/contents.xcworkspacedata
generated
Normal file
@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Workspace
|
||||
version = "1.0">
|
||||
<FileRef
|
||||
location = "group:Runner.xcodeproj">
|
||||
</FileRef>
|
||||
</Workspace>
|
@ -0,0 +1,6 @@
|
||||
#import <UIKit/UIKit.h>
|
||||
#import <Flutter/Flutter.h>
|
||||
|
||||
@interface AppDelegate : FlutterAppDelegate
|
||||
|
||||
@end
|
@ -0,0 +1,12 @@
|
||||
#include "AppDelegate.h"
|
||||
#include "GeneratedPluginRegistrant.h"
|
||||
|
||||
@implementation AppDelegate
|
||||
|
||||
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
|
||||
[GeneratedPluginRegistrant registerWithRegistry:self];
|
||||
// Override point for customization after application launch.
|
||||
return [super application:application didFinishLaunchingWithOptions:launchOptions];
|
||||
}
|
||||
|
||||
@end
|
@ -0,0 +1,116 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"size" : "20x20",
|
||||
"idiom" : "iphone",
|
||||
"filename" : "Icon-App-20x20@2x.png",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"size" : "20x20",
|
||||
"idiom" : "iphone",
|
||||
"filename" : "Icon-App-20x20@3x.png",
|
||||
"scale" : "3x"
|
||||
},
|
||||
{
|
||||
"size" : "29x29",
|
||||
"idiom" : "iphone",
|
||||
"filename" : "Icon-App-29x29@1x.png",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"size" : "29x29",
|
||||
"idiom" : "iphone",
|
||||
"filename" : "Icon-App-29x29@2x.png",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"size" : "29x29",
|
||||
"idiom" : "iphone",
|
||||
"filename" : "Icon-App-29x29@3x.png",
|
||||
"scale" : "3x"
|
||||
},
|
||||
{
|
||||
"size" : "40x40",
|
||||
"idiom" : "iphone",
|
||||
"filename" : "Icon-App-40x40@2x.png",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"size" : "40x40",
|
||||
"idiom" : "iphone",
|
||||
"filename" : "Icon-App-40x40@3x.png",
|
||||
"scale" : "3x"
|
||||
},
|
||||
{
|
||||
"size" : "60x60",
|
||||
"idiom" : "iphone",
|
||||
"filename" : "Icon-App-60x60@2x.png",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"size" : "60x60",
|
||||
"idiom" : "iphone",
|
||||
"filename" : "Icon-App-60x60@3x.png",
|
||||
"scale" : "3x"
|
||||
},
|
||||
{
|
||||
"size" : "20x20",
|
||||
"idiom" : "ipad",
|
||||
"filename" : "Icon-App-20x20@1x.png",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"size" : "20x20",
|
||||
"idiom" : "ipad",
|
||||
"filename" : "Icon-App-20x20@2x.png",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"size" : "29x29",
|
||||
"idiom" : "ipad",
|
||||
"filename" : "Icon-App-29x29@1x.png",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"size" : "29x29",
|
||||
"idiom" : "ipad",
|
||||
"filename" : "Icon-App-29x29@2x.png",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"size" : "40x40",
|
||||
"idiom" : "ipad",
|
||||
"filename" : "Icon-App-40x40@1x.png",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"size" : "40x40",
|
||||
"idiom" : "ipad",
|
||||
"filename" : "Icon-App-40x40@2x.png",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"size" : "76x76",
|
||||
"idiom" : "ipad",
|
||||
"filename" : "Icon-App-76x76@1x.png",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"size" : "76x76",
|
||||
"idiom" : "ipad",
|
||||
"filename" : "Icon-App-76x76@2x.png",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"size" : "83.5x83.5",
|
||||
"idiom" : "ipad",
|
||||
"filename" : "Icon-App-83.5x83.5@2x.png",
|
||||
"scale" : "2x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"version" : 1,
|
||||
"author" : "xcode"
|
||||
}
|
||||
}
|
After Width: | Height: | Size: 564 B |
After Width: | Height: | Size: 1.3 KiB |
After Width: | Height: | Size: 1.6 KiB |
After Width: | Height: | Size: 1.0 KiB |
After Width: | Height: | Size: 1.7 KiB |
After Width: | Height: | Size: 1.9 KiB |
After Width: | Height: | Size: 1.3 KiB |
After Width: | Height: | Size: 1.9 KiB |
After Width: | Height: | Size: 2.6 KiB |
After Width: | Height: | Size: 2.6 KiB |
After Width: | Height: | Size: 3.7 KiB |
After Width: | Height: | Size: 1.8 KiB |
After Width: | Height: | Size: 3.2 KiB |
After Width: | Height: | Size: 3.5 KiB |
@ -0,0 +1,23 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"filename" : "LaunchImage.png",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"filename" : "LaunchImage@2x.png",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"filename" : "LaunchImage@3x.png",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"version" : 1,
|
||||
"author" : "xcode"
|
||||
}
|
||||
}
|
After Width: | Height: | Size: 68 B |
After Width: | Height: | Size: 68 B |
After Width: | Height: | Size: 68 B |
@ -0,0 +1,5 @@
|
||||
# Launch Screen Assets
|
||||
|
||||
You can customize the launch screen with your own desired assets by replacing the image files in this directory.
|
||||
|
||||
You can also do it by opening your Flutter project's Xcode project with `open ios/Runner.xcworkspace`, selecting `Runner/Assets.xcassets` in the Project Navigator and dropping in the desired images.
|
@ -0,0 +1,37 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="12121" systemVersion="16G29" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" colorMatched="YES" initialViewController="01J-lp-oVM">
|
||||
<dependencies>
|
||||
<deployment identifier="iOS"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="12089"/>
|
||||
</dependencies>
|
||||
<scenes>
|
||||
<!--View Controller-->
|
||||
<scene sceneID="EHf-IW-A2E">
|
||||
<objects>
|
||||
<viewController id="01J-lp-oVM" sceneMemberID="viewController">
|
||||
<layoutGuides>
|
||||
<viewControllerLayoutGuide type="top" id="Ydg-fD-yQy"/>
|
||||
<viewControllerLayoutGuide type="bottom" id="xbc-2k-c8Z"/>
|
||||
</layoutGuides>
|
||||
<view key="view" contentMode="scaleToFill" id="Ze5-6b-2t3">
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<subviews>
|
||||
<imageView opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" image="LaunchImage" translatesAutoresizingMaskIntoConstraints="NO" id="YRO-k0-Ey4">
|
||||
</imageView>
|
||||
</subviews>
|
||||
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<constraints>
|
||||
<constraint firstItem="YRO-k0-Ey4" firstAttribute="centerX" secondItem="Ze5-6b-2t3" secondAttribute="centerX" id="1a2-6s-vTC"/>
|
||||
<constraint firstItem="YRO-k0-Ey4" firstAttribute="centerY" secondItem="Ze5-6b-2t3" secondAttribute="centerY" id="4X2-HB-R7a"/>
|
||||
</constraints>
|
||||
</view>
|
||||
</viewController>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="iYj-Kq-Ea1" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
||||
</objects>
|
||||
<point key="canvasLocation" x="53" y="375"/>
|
||||
</scene>
|
||||
</scenes>
|
||||
<resources>
|
||||
<image name="LaunchImage" width="168" height="185"/>
|
||||
</resources>
|
||||
</document>
|
@ -0,0 +1,26 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="10117" systemVersion="15F34" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="BYZ-38-t0r">
|
||||
<dependencies>
|
||||
<deployment identifier="iOS"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="10085"/>
|
||||
</dependencies>
|
||||
<scenes>
|
||||
<!--Flutter View Controller-->
|
||||
<scene sceneID="tne-QT-ifu">
|
||||
<objects>
|
||||
<viewController id="BYZ-38-t0r" customClass="FlutterViewController" sceneMemberID="viewController">
|
||||
<layoutGuides>
|
||||
<viewControllerLayoutGuide type="top" id="y3c-jy-aDJ"/>
|
||||
<viewControllerLayoutGuide type="bottom" id="wfy-db-euE"/>
|
||||
</layoutGuides>
|
||||
<view key="view" contentMode="scaleToFill" id="8bC-Xf-vdC">
|
||||
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
|
||||
</view>
|
||||
</viewController>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="dkx-z0-nzr" sceneMemberID="firstResponder"/>
|
||||
</objects>
|
||||
</scene>
|
||||
</scenes>
|
||||
</document>
|
@ -0,0 +1,49 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>en</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>$(EXECUTABLE_NAME)</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>flutter_petstore</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>APPL</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.0</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>1</string>
|
||||
<key>LSRequiresIPhoneOS</key>
|
||||
<true/>
|
||||
<key>UILaunchStoryboardName</key>
|
||||
<string>LaunchScreen</string>
|
||||
<key>UIMainStoryboardFile</key>
|
||||
<string>Main</string>
|
||||
<key>UIRequiredDeviceCapabilities</key>
|
||||
<array>
|
||||
<string>arm64</string>
|
||||
</array>
|
||||
<key>UISupportedInterfaceOrientations</key>
|
||||
<array>
|
||||
<string>UIInterfaceOrientationPortrait</string>
|
||||
<string>UIInterfaceOrientationLandscapeLeft</string>
|
||||
<string>UIInterfaceOrientationLandscapeRight</string>
|
||||
</array>
|
||||
<key>UISupportedInterfaceOrientations~ipad</key>
|
||||
<array>
|
||||
<string>UIInterfaceOrientationPortrait</string>
|
||||
<string>UIInterfaceOrientationPortraitUpsideDown</string>
|
||||
<string>UIInterfaceOrientationLandscapeLeft</string>
|
||||
<string>UIInterfaceOrientationLandscapeRight</string>
|
||||
</array>
|
||||
<key>UIViewControllerBasedStatusBarAppearance</key>
|
||||
<false/>
|
||||
</dict>
|
||||
</plist>
|
@ -0,0 +1,9 @@
|
||||
#import <UIKit/UIKit.h>
|
||||
#import <Flutter/Flutter.h>
|
||||
#import "AppDelegate.h"
|
||||
|
||||
int main(int argc, char * argv[]) {
|
||||
@autoreleasepool {
|
||||
return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
|
||||
}
|
||||
}
|
164
samples/client/petstore/dart/flutter_petstore/lib/main.dart
Normal file
@ -0,0 +1,164 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:swagger/api.dart';
|
||||
|
||||
void main() => runApp(new MyApp());
|
||||
|
||||
class MyApp extends StatelessWidget {
|
||||
// This widget is the root of your application.
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return new MaterialApp(
|
||||
title: 'Flutter Demo',
|
||||
theme: new ThemeData(
|
||||
// This is the theme of your application.
|
||||
//
|
||||
// Try running your application with "flutter run". You'll see the
|
||||
// application has a blue toolbar. Then, without quitting the app, try
|
||||
// changing the primarySwatch below to Colors.green and then invoke
|
||||
// "hot reload" (press "r" in the console where you ran "flutter run",
|
||||
// or press Run > Flutter Hot Reload in IntelliJ). Notice that the
|
||||
// counter didn't reset back to zero; the application is not restarted.
|
||||
primarySwatch: Colors.blue,
|
||||
),
|
||||
home: new MyHomePage(title: 'Flutter Demo Home Page'),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class MyHomePage extends StatefulWidget {
|
||||
MyHomePage({Key key, this.title}) : super(key: key);
|
||||
|
||||
// This widget is the home page of your application. It is stateful, meaning
|
||||
// that it has a State object (defined below) that contains fields that affect
|
||||
// how it looks.
|
||||
|
||||
// This class is the configuration for the state. It holds the values (in this
|
||||
// case the title) provided by the parent (in this case the App widget) and
|
||||
// used by the build method of the State. Fields in a Widget subclass are
|
||||
// always marked "final".
|
||||
|
||||
final String title;
|
||||
|
||||
@override
|
||||
_MyHomePageState createState() => new _MyHomePageState();
|
||||
}
|
||||
|
||||
class _MyHomePageState extends State<MyHomePage> {
|
||||
int _counter = 0;
|
||||
|
||||
void _incrementCounter() {
|
||||
setState(() {
|
||||
// This call to setState tells the Flutter framework that something has
|
||||
// changed in this State, which causes it to rerun the build method below
|
||||
// so that the display can reflect the updated values. If we changed
|
||||
// _counter without calling setState(), then the build method would not be
|
||||
// called again, and so nothing would appear to happen.
|
||||
_counter++;
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
fetchPets();
|
||||
fetchStoreInventory();
|
||||
fetchUser();
|
||||
}
|
||||
|
||||
void fetchPets() {
|
||||
print('fetching pets by status...');
|
||||
var statuses = new List<String>();
|
||||
statuses.add('available');
|
||||
new PetApi(defaultApiClient).findPetsByStatus(statuses)
|
||||
.then((List<Pet> pets) {
|
||||
print('pets received: ');
|
||||
print(pets);
|
||||
var order = new Order();
|
||||
order.petId = pets[0].id;
|
||||
order.quantity = 1;
|
||||
new StoreApi(defaultApiClient).placeOrder(order)
|
||||
.then((Order order) => print(order));
|
||||
}).catchError((error) {
|
||||
print('error fetching pets');
|
||||
print(error);
|
||||
});
|
||||
}
|
||||
|
||||
void fetchStoreInventory() {
|
||||
print('fetching inventory...');
|
||||
new StoreApi(defaultApiClient).getInventory()
|
||||
.then((Map<String, int> inventory) {
|
||||
print('inventory received: ');
|
||||
print(inventory);
|
||||
}).catchError((error) {
|
||||
print('error fetching inventory');
|
||||
print(error);
|
||||
});
|
||||
}
|
||||
|
||||
void fetchUser() {
|
||||
print('fetching user1...');
|
||||
new UserApi(defaultApiClient).getUserByName('user1')
|
||||
.then((User user) {
|
||||
print('user received: ');
|
||||
print(user);
|
||||
}).catchError((error) {
|
||||
print('error fetching user');
|
||||
print(error);
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
// This method is rerun every time setState is called, for instance as done
|
||||
// by the _incrementCounter method above.
|
||||
//
|
||||
// The Flutter framework has been optimized to make rerunning build methods
|
||||
// fast, so that you can just rebuild anything that needs updating rather
|
||||
// than having to individually change instances of widgets.
|
||||
return new Scaffold(
|
||||
appBar: new AppBar(
|
||||
// Here we take the value from the MyHomePage object that was created by
|
||||
// the App.build method, and use it to set our appbar title.
|
||||
title: new Text(widget.title),
|
||||
),
|
||||
body: new Center(
|
||||
// Center is a layout widget. It takes a single child and positions it
|
||||
// in the middle of the parent.
|
||||
child: new Column(
|
||||
// Column is also layout widget. It takes a list of children and
|
||||
// arranges them vertically. By default, it sizes itself to fit its
|
||||
// children horizontally, and tries to be as tall as its parent.
|
||||
//
|
||||
// Invoke "debug paint" (press "p" in the console where you ran
|
||||
// "flutter run", or select "Toggle Debug Paint" from the Flutter tool
|
||||
// window in IntelliJ) to see the wireframe for each widget.
|
||||
//
|
||||
// Column has various properties to control how it sizes itself and
|
||||
// how it positions its children. Here we use mainAxisAlignment to
|
||||
// center the children vertically; the main axis here is the vertical
|
||||
// axis because Columns are vertical (the cross axis would be
|
||||
// horizontal).
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: <Widget>[
|
||||
new Text(
|
||||
'You have pushed the button this many times:',
|
||||
),
|
||||
new Text(
|
||||
'$_counter',
|
||||
style: Theme
|
||||
.of(context)
|
||||
.textTheme
|
||||
.display1,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
floatingActionButton: new FloatingActionButton(
|
||||
onPressed: _incrementCounter,
|
||||
tooltip: 'Increment',
|
||||
child: new Icon(Icons.add),
|
||||
), // This trailing comma makes auto-formatting nicer for build methods.
|
||||
);
|
||||
}
|
||||
}
|
59
samples/client/petstore/dart/flutter_petstore/pubspec.yaml
Normal file
@ -0,0 +1,59 @@
|
||||
name: flutter_petstore
|
||||
description: Swagger petstore sample flutter
|
||||
|
||||
dependencies:
|
||||
flutter:
|
||||
sdk: flutter
|
||||
swagger:
|
||||
path: ./swagger
|
||||
|
||||
# The following adds the Cupertino Icons font to your application.
|
||||
# Use with the CupertinoIcons class for iOS style icons.
|
||||
cupertino_icons: ^0.1.0
|
||||
|
||||
dev_dependencies:
|
||||
flutter_test:
|
||||
sdk: flutter
|
||||
|
||||
|
||||
# For information on the generic Dart part of this file, see the
|
||||
# following page: https://www.dartlang.org/tools/pub/pubspec
|
||||
|
||||
# The following section is specific to Flutter.
|
||||
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.io/assets-and-images/#resolution-aware.
|
||||
|
||||
# For details regarding adding assets from package dependencies, see
|
||||
# https://flutter.io/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.io/custom-fonts/#from-packages
|
@ -0,0 +1,2 @@
|
||||
analyzer:
|
||||
strong-mode: true
|
27
samples/client/petstore/dart/flutter_petstore/swagger/.gitignore
vendored
Normal file
@ -0,0 +1,27 @@
|
||||
# See https://www.dartlang.org/tools/private-files.html
|
||||
|
||||
# Files and directories created by pub
|
||||
.buildlog
|
||||
.packages
|
||||
.project
|
||||
.pub/
|
||||
build/
|
||||
**/packages/
|
||||
|
||||
# Files created by dart2js
|
||||
# (Most Dart developers will use pub build to compile Dart, use/modify these
|
||||
# rules if you intend to use dart2js directly
|
||||
# Convention is to use extension '.dart.js' for Dart compiled to Javascript to
|
||||
# differentiate from explicit Javascript files)
|
||||
*.dart.js
|
||||
*.part.js
|
||||
*.js.deps
|
||||
*.js.map
|
||||
*.info.json
|
||||
|
||||
# Directory created by dartdoc
|
||||
doc/api/
|
||||
|
||||
# Don't commit pubspec lock file
|
||||
# (Library packages only! Remove pattern if developing an application package)
|
||||
pubspec.lock
|
@ -0,0 +1,23 @@
|
||||
# Swagger Codegen Ignore
|
||||
# Generated by swagger-codegen https://github.com/swagger-api/swagger-codegen
|
||||
|
||||
# Use this file to prevent files from being overwritten by the generator.
|
||||
# The patterns follow closely to .gitignore or .dockerignore.
|
||||
|
||||
# As an example, the C# client generator defines ApiClient.cs.
|
||||
# You can make changes and tell Swagger Codgen to ignore just this file by uncommenting the following line:
|
||||
#ApiClient.cs
|
||||
|
||||
# You can match any string of characters against a directory, file or extension with a single asterisk (*):
|
||||
#foo/*/qux
|
||||
# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux
|
||||
|
||||
# You can recursively match patterns against a directory, file or extension with a double asterisk (**):
|
||||
#foo/**/qux
|
||||
# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux
|
||||
|
||||
# You can also negate patterns with an exclamation (!).
|
||||
# For example, you can ignore all files in a docs folder with the file extension .md:
|
||||
#docs/*.md
|
||||
# Then explicitly reverse the ignore rule for a single file:
|
||||
#!docs/README.md
|
@ -0,0 +1 @@
|
||||
2.3.1
|
121
samples/client/petstore/dart/flutter_petstore/swagger/README.md
Normal file
@ -0,0 +1,121 @@
|
||||
# swagger
|
||||
This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters.
|
||||
|
||||
This Dart package is automatically generated by the [Swagger Codegen](https://github.com/swagger-api/swagger-codegen) project:
|
||||
|
||||
- API version: 1.0.0
|
||||
- Build package: io.swagger.codegen.languages.DartClientCodegen
|
||||
|
||||
## Requirements
|
||||
|
||||
Dart 1.20.0 or later OR Flutter 0.0.20 or later
|
||||
|
||||
## Installation & Usage
|
||||
|
||||
### Github
|
||||
If this Dart package is published to Github, please include the following in pubspec.yaml
|
||||
```
|
||||
name: swagger
|
||||
version: 1.0.0
|
||||
description: Swagger API client
|
||||
dependencies:
|
||||
swagger:
|
||||
git: https://github.com/GIT_USER_ID/GIT_REPO_ID.git
|
||||
version: 'any'
|
||||
```
|
||||
|
||||
### Local
|
||||
To use the package in your local drive, please include the following in pubspec.yaml
|
||||
```
|
||||
dependencies:
|
||||
swagger:
|
||||
path: /path/to/swagger
|
||||
```
|
||||
|
||||
## Tests
|
||||
|
||||
TODO
|
||||
|
||||
## Getting Started
|
||||
|
||||
Please follow the [installation procedure](#installation--usage) and then run the following:
|
||||
|
||||
```dart
|
||||
import 'package:swagger/api.dart';
|
||||
|
||||
// TODO Configure OAuth2 access token for authorization: petstore_auth
|
||||
//swagger.api.Configuration.accessToken = 'YOUR_ACCESS_TOKEN';
|
||||
|
||||
var api_instance = new PetApi();
|
||||
var body = new Pet(); // Pet | Pet object that needs to be added to the store
|
||||
|
||||
try {
|
||||
api_instance.addPet(body);
|
||||
} catch (e) {
|
||||
print("Exception when calling PetApi->addPet: $e\n");
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
## Documentation for API Endpoints
|
||||
|
||||
All URIs are relative to *http://petstore.swagger.io/v2*
|
||||
|
||||
Class | Method | HTTP request | Description
|
||||
------------ | ------------- | ------------- | -------------
|
||||
*PetApi* | [**addPet**](docs//PetApi.md#addpet) | **POST** /pet | Add a new pet to the store
|
||||
*PetApi* | [**deletePet**](docs//PetApi.md#deletepet) | **DELETE** /pet/{petId} | Deletes a pet
|
||||
*PetApi* | [**findPetsByStatus**](docs//PetApi.md#findpetsbystatus) | **GET** /pet/findByStatus | Finds Pets by status
|
||||
*PetApi* | [**findPetsByTags**](docs//PetApi.md#findpetsbytags) | **GET** /pet/findByTags | Finds Pets by tags
|
||||
*PetApi* | [**getPetById**](docs//PetApi.md#getpetbyid) | **GET** /pet/{petId} | Find pet by ID
|
||||
*PetApi* | [**updatePet**](docs//PetApi.md#updatepet) | **PUT** /pet | Update an existing pet
|
||||
*PetApi* | [**updatePetWithForm**](docs//PetApi.md#updatepetwithform) | **POST** /pet/{petId} | Updates a pet in the store with form data
|
||||
*PetApi* | [**uploadFile**](docs//PetApi.md#uploadfile) | **POST** /pet/{petId}/uploadImage | uploads an image
|
||||
*StoreApi* | [**deleteOrder**](docs//StoreApi.md#deleteorder) | **DELETE** /store/order/{orderId} | Delete purchase order by ID
|
||||
*StoreApi* | [**getInventory**](docs//StoreApi.md#getinventory) | **GET** /store/inventory | Returns pet inventories by status
|
||||
*StoreApi* | [**getOrderById**](docs//StoreApi.md#getorderbyid) | **GET** /store/order/{orderId} | Find purchase order by ID
|
||||
*StoreApi* | [**placeOrder**](docs//StoreApi.md#placeorder) | **POST** /store/order | Place an order for a pet
|
||||
*UserApi* | [**createUser**](docs//UserApi.md#createuser) | **POST** /user | Create user
|
||||
*UserApi* | [**createUsersWithArrayInput**](docs//UserApi.md#createuserswitharrayinput) | **POST** /user/createWithArray | Creates list of users with given input array
|
||||
*UserApi* | [**createUsersWithListInput**](docs//UserApi.md#createuserswithlistinput) | **POST** /user/createWithList | Creates list of users with given input array
|
||||
*UserApi* | [**deleteUser**](docs//UserApi.md#deleteuser) | **DELETE** /user/{username} | Delete user
|
||||
*UserApi* | [**getUserByName**](docs//UserApi.md#getuserbyname) | **GET** /user/{username} | Get user by user name
|
||||
*UserApi* | [**loginUser**](docs//UserApi.md#loginuser) | **GET** /user/login | Logs user into the system
|
||||
*UserApi* | [**logoutUser**](docs//UserApi.md#logoutuser) | **GET** /user/logout | Logs out current logged in user session
|
||||
*UserApi* | [**updateUser**](docs//UserApi.md#updateuser) | **PUT** /user/{username} | Updated user
|
||||
|
||||
|
||||
## Documentation For Models
|
||||
|
||||
- [ApiResponse](docs//ApiResponse.md)
|
||||
- [Category](docs//Category.md)
|
||||
- [Order](docs//Order.md)
|
||||
- [Pet](docs//Pet.md)
|
||||
- [Tag](docs//Tag.md)
|
||||
- [User](docs//User.md)
|
||||
|
||||
|
||||
## Documentation For Authorization
|
||||
|
||||
|
||||
## api_key
|
||||
|
||||
- **Type**: API key
|
||||
- **API key parameter name**: api_key
|
||||
- **Location**: HTTP header
|
||||
|
||||
## petstore_auth
|
||||
|
||||
- **Type**: OAuth
|
||||
- **Flow**: implicit
|
||||
- **Authorization URL**: http://petstore.swagger.io/api/oauth/dialog
|
||||
- **Scopes**:
|
||||
- **write:pets**: modify pets in your account
|
||||
- **read:pets**: read your pets
|
||||
|
||||
|
||||
## Author
|
||||
|
||||
apiteam@swagger.io
|
||||
|
||||
|
@ -0,0 +1,17 @@
|
||||
# swagger.model.ApiResponse
|
||||
|
||||
## Load the model package
|
||||
```dart
|
||||
import 'package:swagger/api.dart';
|
||||
```
|
||||
|
||||
## Properties
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**code** | **int** | | [optional] [default to null]
|
||||
**type** | **String** | | [optional] [default to null]
|
||||
**message** | **String** | | [optional] [default to null]
|
||||
|
||||
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||
|
||||
|
@ -0,0 +1,16 @@
|
||||
# swagger.model.Category
|
||||
|
||||
## Load the model package
|
||||
```dart
|
||||
import 'package:swagger/api.dart';
|
||||
```
|
||||
|
||||
## Properties
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**id** | **int** | | [optional] [default to null]
|
||||
**name** | **String** | | [optional] [default to null]
|
||||
|
||||
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||
|
||||
|
@ -0,0 +1,20 @@
|
||||
# swagger.model.Order
|
||||
|
||||
## Load the model package
|
||||
```dart
|
||||
import 'package:swagger/api.dart';
|
||||
```
|
||||
|
||||
## Properties
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**id** | **int** | | [optional] [default to null]
|
||||
**petId** | **int** | | [optional] [default to null]
|
||||
**quantity** | **int** | | [optional] [default to null]
|
||||
**shipDate** | [**DateTime**](DateTime.md) | | [optional] [default to null]
|
||||
**status** | **String** | Order Status | [optional] [default to null]
|
||||
**complete** | **bool** | | [optional] [default to null]
|
||||
|
||||
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||
|
||||
|
@ -0,0 +1,20 @@
|
||||
# swagger.model.Pet
|
||||
|
||||
## Load the model package
|
||||
```dart
|
||||
import 'package:swagger/api.dart';
|
||||
```
|
||||
|
||||
## Properties
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**id** | **int** | | [optional] [default to null]
|
||||
**category** | [**Category**](Category.md) | | [optional] [default to null]
|
||||
**name** | **String** | | [default to null]
|
||||
**photoUrls** | **List<String>** | | [default to []]
|
||||
**tags** | [**List<Tag>**](Tag.md) | | [optional] [default to []]
|
||||
**status** | **String** | pet status in the store | [optional] [default to null]
|
||||
|
||||
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||
|
||||
|
@ -0,0 +1,389 @@
|
||||
# swagger.api.PetApi
|
||||
|
||||
## Load the API package
|
||||
```dart
|
||||
import 'package:swagger/api.dart';
|
||||
```
|
||||
|
||||
All URIs are relative to *http://petstore.swagger.io/v2*
|
||||
|
||||
Method | HTTP request | Description
|
||||
------------- | ------------- | -------------
|
||||
[**addPet**](PetApi.md#addPet) | **POST** /pet | Add a new pet to the store
|
||||
[**deletePet**](PetApi.md#deletePet) | **DELETE** /pet/{petId} | Deletes a pet
|
||||
[**findPetsByStatus**](PetApi.md#findPetsByStatus) | **GET** /pet/findByStatus | Finds Pets by status
|
||||
[**findPetsByTags**](PetApi.md#findPetsByTags) | **GET** /pet/findByTags | Finds Pets by tags
|
||||
[**getPetById**](PetApi.md#getPetById) | **GET** /pet/{petId} | Find pet by ID
|
||||
[**updatePet**](PetApi.md#updatePet) | **PUT** /pet | Update an existing pet
|
||||
[**updatePetWithForm**](PetApi.md#updatePetWithForm) | **POST** /pet/{petId} | Updates a pet in the store with form data
|
||||
[**uploadFile**](PetApi.md#uploadFile) | **POST** /pet/{petId}/uploadImage | uploads an image
|
||||
|
||||
|
||||
# **addPet**
|
||||
> addPet(body)
|
||||
|
||||
Add a new pet to the store
|
||||
|
||||
|
||||
|
||||
### Example
|
||||
```dart
|
||||
import 'package:swagger/api.dart';
|
||||
// TODO Configure OAuth2 access token for authorization: petstore_auth
|
||||
//swagger.api.Configuration.accessToken = 'YOUR_ACCESS_TOKEN';
|
||||
|
||||
var api_instance = new PetApi();
|
||||
var body = new Pet(); // Pet | Pet object that needs to be added to the store
|
||||
|
||||
try {
|
||||
api_instance.addPet(body);
|
||||
} catch (e) {
|
||||
print("Exception when calling PetApi->addPet: $e\n");
|
||||
}
|
||||
```
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**body** | [**Pet**](Pet.md)| Pet object that needs to be added to the store |
|
||||
|
||||
### Return type
|
||||
|
||||
void (empty response body)
|
||||
|
||||
### Authorization
|
||||
|
||||
[petstore_auth](../README.md#petstore_auth)
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: application/json, application/xml
|
||||
- **Accept**: application/xml, application/json
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
||||
|
||||
# **deletePet**
|
||||
> deletePet(petId, apiKey)
|
||||
|
||||
Deletes a pet
|
||||
|
||||
|
||||
|
||||
### Example
|
||||
```dart
|
||||
import 'package:swagger/api.dart';
|
||||
// TODO Configure OAuth2 access token for authorization: petstore_auth
|
||||
//swagger.api.Configuration.accessToken = 'YOUR_ACCESS_TOKEN';
|
||||
|
||||
var api_instance = new PetApi();
|
||||
var petId = 789; // int | Pet id to delete
|
||||
var apiKey = apiKey_example; // String |
|
||||
|
||||
try {
|
||||
api_instance.deletePet(petId, apiKey);
|
||||
} catch (e) {
|
||||
print("Exception when calling PetApi->deletePet: $e\n");
|
||||
}
|
||||
```
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**petId** | **int**| Pet id to delete |
|
||||
**apiKey** | **String**| | [optional]
|
||||
|
||||
### Return type
|
||||
|
||||
void (empty response body)
|
||||
|
||||
### Authorization
|
||||
|
||||
[petstore_auth](../README.md#petstore_auth)
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: application/xml, application/json
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
||||
|
||||
# **findPetsByStatus**
|
||||
> List<Pet> findPetsByStatus(status)
|
||||
|
||||
Finds Pets by status
|
||||
|
||||
Multiple status values can be provided with comma separated strings
|
||||
|
||||
### Example
|
||||
```dart
|
||||
import 'package:swagger/api.dart';
|
||||
// TODO Configure OAuth2 access token for authorization: petstore_auth
|
||||
//swagger.api.Configuration.accessToken = 'YOUR_ACCESS_TOKEN';
|
||||
|
||||
var api_instance = new PetApi();
|
||||
var status = []; // List<String> | Status values that need to be considered for filter
|
||||
|
||||
try {
|
||||
var result = api_instance.findPetsByStatus(status);
|
||||
print(result);
|
||||
} catch (e) {
|
||||
print("Exception when calling PetApi->findPetsByStatus: $e\n");
|
||||
}
|
||||
```
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**status** | [**List<String>**](String.md)| Status values that need to be considered for filter |
|
||||
|
||||
### Return type
|
||||
|
||||
[**List<Pet>**](Pet.md)
|
||||
|
||||
### Authorization
|
||||
|
||||
[petstore_auth](../README.md#petstore_auth)
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: application/xml, application/json
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
||||
|
||||
# **findPetsByTags**
|
||||
> List<Pet> findPetsByTags(tags)
|
||||
|
||||
Finds Pets by tags
|
||||
|
||||
Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
|
||||
|
||||
### Example
|
||||
```dart
|
||||
import 'package:swagger/api.dart';
|
||||
// TODO Configure OAuth2 access token for authorization: petstore_auth
|
||||
//swagger.api.Configuration.accessToken = 'YOUR_ACCESS_TOKEN';
|
||||
|
||||
var api_instance = new PetApi();
|
||||
var tags = []; // List<String> | Tags to filter by
|
||||
|
||||
try {
|
||||
var result = api_instance.findPetsByTags(tags);
|
||||
print(result);
|
||||
} catch (e) {
|
||||
print("Exception when calling PetApi->findPetsByTags: $e\n");
|
||||
}
|
||||
```
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**tags** | [**List<String>**](String.md)| Tags to filter by |
|
||||
|
||||
### Return type
|
||||
|
||||
[**List<Pet>**](Pet.md)
|
||||
|
||||
### Authorization
|
||||
|
||||
[petstore_auth](../README.md#petstore_auth)
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: application/xml, application/json
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
||||
|
||||
# **getPetById**
|
||||
> Pet getPetById(petId)
|
||||
|
||||
Find pet by ID
|
||||
|
||||
Returns a single pet
|
||||
|
||||
### Example
|
||||
```dart
|
||||
import 'package:swagger/api.dart';
|
||||
// TODO Configure API key authorization: api_key
|
||||
//swagger.api.Configuration.apiKey{'api_key'} = 'YOUR_API_KEY';
|
||||
// uncomment below to setup prefix (e.g. Bearer) for API key, if needed
|
||||
//swagger.api.Configuration.apiKeyPrefix{'api_key'} = "Bearer";
|
||||
|
||||
var api_instance = new PetApi();
|
||||
var petId = 789; // int | ID of pet to return
|
||||
|
||||
try {
|
||||
var result = api_instance.getPetById(petId);
|
||||
print(result);
|
||||
} catch (e) {
|
||||
print("Exception when calling PetApi->getPetById: $e\n");
|
||||
}
|
||||
```
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**petId** | **int**| ID of pet to return |
|
||||
|
||||
### Return type
|
||||
|
||||
[**Pet**](Pet.md)
|
||||
|
||||
### Authorization
|
||||
|
||||
[api_key](../README.md#api_key)
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: application/xml, application/json
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
||||
|
||||
# **updatePet**
|
||||
> updatePet(body)
|
||||
|
||||
Update an existing pet
|
||||
|
||||
|
||||
|
||||
### Example
|
||||
```dart
|
||||
import 'package:swagger/api.dart';
|
||||
// TODO Configure OAuth2 access token for authorization: petstore_auth
|
||||
//swagger.api.Configuration.accessToken = 'YOUR_ACCESS_TOKEN';
|
||||
|
||||
var api_instance = new PetApi();
|
||||
var body = new Pet(); // Pet | Pet object that needs to be added to the store
|
||||
|
||||
try {
|
||||
api_instance.updatePet(body);
|
||||
} catch (e) {
|
||||
print("Exception when calling PetApi->updatePet: $e\n");
|
||||
}
|
||||
```
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**body** | [**Pet**](Pet.md)| Pet object that needs to be added to the store |
|
||||
|
||||
### Return type
|
||||
|
||||
void (empty response body)
|
||||
|
||||
### Authorization
|
||||
|
||||
[petstore_auth](../README.md#petstore_auth)
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: application/json, application/xml
|
||||
- **Accept**: application/xml, application/json
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
||||
|
||||
# **updatePetWithForm**
|
||||
> updatePetWithForm(petId, name, status)
|
||||
|
||||
Updates a pet in the store with form data
|
||||
|
||||
|
||||
|
||||
### Example
|
||||
```dart
|
||||
import 'package:swagger/api.dart';
|
||||
// TODO Configure OAuth2 access token for authorization: petstore_auth
|
||||
//swagger.api.Configuration.accessToken = 'YOUR_ACCESS_TOKEN';
|
||||
|
||||
var api_instance = new PetApi();
|
||||
var petId = 789; // int | ID of pet that needs to be updated
|
||||
var name = name_example; // String | Updated name of the pet
|
||||
var status = status_example; // String | Updated status of the pet
|
||||
|
||||
try {
|
||||
api_instance.updatePetWithForm(petId, name, status);
|
||||
} catch (e) {
|
||||
print("Exception when calling PetApi->updatePetWithForm: $e\n");
|
||||
}
|
||||
```
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**petId** | **int**| ID of pet that needs to be updated |
|
||||
**name** | **String**| Updated name of the pet | [optional]
|
||||
**status** | **String**| Updated status of the pet | [optional]
|
||||
|
||||
### Return type
|
||||
|
||||
void (empty response body)
|
||||
|
||||
### Authorization
|
||||
|
||||
[petstore_auth](../README.md#petstore_auth)
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: application/x-www-form-urlencoded
|
||||
- **Accept**: application/xml, application/json
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
||||
|
||||
# **uploadFile**
|
||||
> ApiResponse uploadFile(petId, additionalMetadata, file)
|
||||
|
||||
uploads an image
|
||||
|
||||
|
||||
|
||||
### Example
|
||||
```dart
|
||||
import 'package:swagger/api.dart';
|
||||
// TODO Configure OAuth2 access token for authorization: petstore_auth
|
||||
//swagger.api.Configuration.accessToken = 'YOUR_ACCESS_TOKEN';
|
||||
|
||||
var api_instance = new PetApi();
|
||||
var petId = 789; // int | ID of pet to update
|
||||
var additionalMetadata = additionalMetadata_example; // String | Additional data to pass to server
|
||||
var file = /path/to/file.txt; // MultipartFile | file to upload
|
||||
|
||||
try {
|
||||
var result = api_instance.uploadFile(petId, additionalMetadata, file);
|
||||
print(result);
|
||||
} catch (e) {
|
||||
print("Exception when calling PetApi->uploadFile: $e\n");
|
||||
}
|
||||
```
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**petId** | **int**| ID of pet to update |
|
||||
**additionalMetadata** | **String**| Additional data to pass to server | [optional]
|
||||
**file** | **MultipartFile**| file to upload | [optional]
|
||||
|
||||
### Return type
|
||||
|
||||
[**ApiResponse**](ApiResponse.md)
|
||||
|
||||
### Authorization
|
||||
|
||||
[petstore_auth](../README.md#petstore_auth)
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: multipart/form-data
|
||||
- **Accept**: application/json
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
||||
|
@ -0,0 +1,188 @@
|
||||
# swagger.api.StoreApi
|
||||
|
||||
## Load the API package
|
||||
```dart
|
||||
import 'package:swagger/api.dart';
|
||||
```
|
||||
|
||||
All URIs are relative to *http://petstore.swagger.io/v2*
|
||||
|
||||
Method | HTTP request | Description
|
||||
------------- | ------------- | -------------
|
||||
[**deleteOrder**](StoreApi.md#deleteOrder) | **DELETE** /store/order/{orderId} | Delete purchase order by ID
|
||||
[**getInventory**](StoreApi.md#getInventory) | **GET** /store/inventory | Returns pet inventories by status
|
||||
[**getOrderById**](StoreApi.md#getOrderById) | **GET** /store/order/{orderId} | Find purchase order by ID
|
||||
[**placeOrder**](StoreApi.md#placeOrder) | **POST** /store/order | Place an order for a pet
|
||||
|
||||
|
||||
# **deleteOrder**
|
||||
> deleteOrder(orderId)
|
||||
|
||||
Delete purchase order by ID
|
||||
|
||||
For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors
|
||||
|
||||
### Example
|
||||
```dart
|
||||
import 'package:swagger/api.dart';
|
||||
|
||||
var api_instance = new StoreApi();
|
||||
var orderId = orderId_example; // String | ID of the order that needs to be deleted
|
||||
|
||||
try {
|
||||
api_instance.deleteOrder(orderId);
|
||||
} catch (e) {
|
||||
print("Exception when calling StoreApi->deleteOrder: $e\n");
|
||||
}
|
||||
```
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**orderId** | **String**| ID of the order that needs to be deleted |
|
||||
|
||||
### Return type
|
||||
|
||||
void (empty response body)
|
||||
|
||||
### Authorization
|
||||
|
||||
No authorization required
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: application/xml, application/json
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
||||
|
||||
# **getInventory**
|
||||
> Map<String, int> getInventory()
|
||||
|
||||
Returns pet inventories by status
|
||||
|
||||
Returns a map of status codes to quantities
|
||||
|
||||
### Example
|
||||
```dart
|
||||
import 'package:swagger/api.dart';
|
||||
// TODO Configure API key authorization: api_key
|
||||
//swagger.api.Configuration.apiKey{'api_key'} = 'YOUR_API_KEY';
|
||||
// uncomment below to setup prefix (e.g. Bearer) for API key, if needed
|
||||
//swagger.api.Configuration.apiKeyPrefix{'api_key'} = "Bearer";
|
||||
|
||||
var api_instance = new StoreApi();
|
||||
|
||||
try {
|
||||
var result = api_instance.getInventory();
|
||||
print(result);
|
||||
} catch (e) {
|
||||
print("Exception when calling StoreApi->getInventory: $e\n");
|
||||
}
|
||||
```
|
||||
|
||||
### Parameters
|
||||
This endpoint does not need any parameter.
|
||||
|
||||
### Return type
|
||||
|
||||
**Map<String, int>**
|
||||
|
||||
### Authorization
|
||||
|
||||
[api_key](../README.md#api_key)
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: application/json
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
||||
|
||||
# **getOrderById**
|
||||
> Order getOrderById(orderId)
|
||||
|
||||
Find purchase order by ID
|
||||
|
||||
For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions
|
||||
|
||||
### Example
|
||||
```dart
|
||||
import 'package:swagger/api.dart';
|
||||
|
||||
var api_instance = new StoreApi();
|
||||
var orderId = 789; // int | ID of pet that needs to be fetched
|
||||
|
||||
try {
|
||||
var result = api_instance.getOrderById(orderId);
|
||||
print(result);
|
||||
} catch (e) {
|
||||
print("Exception when calling StoreApi->getOrderById: $e\n");
|
||||
}
|
||||
```
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**orderId** | **int**| ID of pet that needs to be fetched |
|
||||
|
||||
### Return type
|
||||
|
||||
[**Order**](Order.md)
|
||||
|
||||
### Authorization
|
||||
|
||||
No authorization required
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: application/xml, application/json
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
||||
|
||||
# **placeOrder**
|
||||
> Order placeOrder(body)
|
||||
|
||||
Place an order for a pet
|
||||
|
||||
|
||||
|
||||
### Example
|
||||
```dart
|
||||
import 'package:swagger/api.dart';
|
||||
|
||||
var api_instance = new StoreApi();
|
||||
var body = new Order(); // Order | order placed for purchasing the pet
|
||||
|
||||
try {
|
||||
var result = api_instance.placeOrder(body);
|
||||
print(result);
|
||||
} catch (e) {
|
||||
print("Exception when calling StoreApi->placeOrder: $e\n");
|
||||
}
|
||||
```
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**body** | [**Order**](Order.md)| order placed for purchasing the pet |
|
||||
|
||||
### Return type
|
||||
|
||||
[**Order**](Order.md)
|
||||
|
||||
### Authorization
|
||||
|
||||
No authorization required
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: application/xml, application/json
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
||||
|
@ -0,0 +1,16 @@
|
||||
# swagger.model.Tag
|
||||
|
||||
## Load the model package
|
||||
```dart
|
||||
import 'package:swagger/api.dart';
|
||||
```
|
||||
|
||||
## Properties
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**id** | **int** | | [optional] [default to null]
|
||||
**name** | **String** | | [optional] [default to null]
|
||||
|
||||
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||
|
||||
|
@ -0,0 +1,22 @@
|
||||
# swagger.model.User
|
||||
|
||||
## Load the model package
|
||||
```dart
|
||||
import 'package:swagger/api.dart';
|
||||
```
|
||||
|
||||
## Properties
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**id** | **int** | | [optional] [default to null]
|
||||
**username** | **String** | | [optional] [default to null]
|
||||
**firstName** | **String** | | [optional] [default to null]
|
||||
**lastName** | **String** | | [optional] [default to null]
|
||||
**email** | **String** | | [optional] [default to null]
|
||||
**password** | **String** | | [optional] [default to null]
|
||||
**phone** | **String** | | [optional] [default to null]
|
||||
**userStatus** | **int** | User Status | [optional] [default to null]
|
||||
|
||||
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||
|
||||
|
@ -0,0 +1,359 @@
|
||||
# swagger.api.UserApi
|
||||
|
||||
## Load the API package
|
||||
```dart
|
||||
import 'package:swagger/api.dart';
|
||||
```
|
||||
|
||||
All URIs are relative to *http://petstore.swagger.io/v2*
|
||||
|
||||
Method | HTTP request | Description
|
||||
------------- | ------------- | -------------
|
||||
[**createUser**](UserApi.md#createUser) | **POST** /user | Create user
|
||||
[**createUsersWithArrayInput**](UserApi.md#createUsersWithArrayInput) | **POST** /user/createWithArray | Creates list of users with given input array
|
||||
[**createUsersWithListInput**](UserApi.md#createUsersWithListInput) | **POST** /user/createWithList | Creates list of users with given input array
|
||||
[**deleteUser**](UserApi.md#deleteUser) | **DELETE** /user/{username} | Delete user
|
||||
[**getUserByName**](UserApi.md#getUserByName) | **GET** /user/{username} | Get user by user name
|
||||
[**loginUser**](UserApi.md#loginUser) | **GET** /user/login | Logs user into the system
|
||||
[**logoutUser**](UserApi.md#logoutUser) | **GET** /user/logout | Logs out current logged in user session
|
||||
[**updateUser**](UserApi.md#updateUser) | **PUT** /user/{username} | Updated user
|
||||
|
||||
|
||||
# **createUser**
|
||||
> createUser(body)
|
||||
|
||||
Create user
|
||||
|
||||
This can only be done by the logged in user.
|
||||
|
||||
### Example
|
||||
```dart
|
||||
import 'package:swagger/api.dart';
|
||||
|
||||
var api_instance = new UserApi();
|
||||
var body = new User(); // User | Created user object
|
||||
|
||||
try {
|
||||
api_instance.createUser(body);
|
||||
} catch (e) {
|
||||
print("Exception when calling UserApi->createUser: $e\n");
|
||||
}
|
||||
```
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**body** | [**User**](User.md)| Created user object |
|
||||
|
||||
### Return type
|
||||
|
||||
void (empty response body)
|
||||
|
||||
### Authorization
|
||||
|
||||
No authorization required
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: application/xml, application/json
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
||||
|
||||
# **createUsersWithArrayInput**
|
||||
> createUsersWithArrayInput(body)
|
||||
|
||||
Creates list of users with given input array
|
||||
|
||||
|
||||
|
||||
### Example
|
||||
```dart
|
||||
import 'package:swagger/api.dart';
|
||||
|
||||
var api_instance = new UserApi();
|
||||
var body = [new List<User>()]; // List<User> | List of user object
|
||||
|
||||
try {
|
||||
api_instance.createUsersWithArrayInput(body);
|
||||
} catch (e) {
|
||||
print("Exception when calling UserApi->createUsersWithArrayInput: $e\n");
|
||||
}
|
||||
```
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**body** | [**List<User>**](User.md)| List of user object |
|
||||
|
||||
### Return type
|
||||
|
||||
void (empty response body)
|
||||
|
||||
### Authorization
|
||||
|
||||
No authorization required
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: application/xml, application/json
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
||||
|
||||
# **createUsersWithListInput**
|
||||
> createUsersWithListInput(body)
|
||||
|
||||
Creates list of users with given input array
|
||||
|
||||
|
||||
|
||||
### Example
|
||||
```dart
|
||||
import 'package:swagger/api.dart';
|
||||
|
||||
var api_instance = new UserApi();
|
||||
var body = [new List<User>()]; // List<User> | List of user object
|
||||
|
||||
try {
|
||||
api_instance.createUsersWithListInput(body);
|
||||
} catch (e) {
|
||||
print("Exception when calling UserApi->createUsersWithListInput: $e\n");
|
||||
}
|
||||
```
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**body** | [**List<User>**](User.md)| List of user object |
|
||||
|
||||
### Return type
|
||||
|
||||
void (empty response body)
|
||||
|
||||
### Authorization
|
||||
|
||||
No authorization required
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: application/xml, application/json
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
||||
|
||||
# **deleteUser**
|
||||
> deleteUser(username)
|
||||
|
||||
Delete user
|
||||
|
||||
This can only be done by the logged in user.
|
||||
|
||||
### Example
|
||||
```dart
|
||||
import 'package:swagger/api.dart';
|
||||
|
||||
var api_instance = new UserApi();
|
||||
var username = username_example; // String | The name that needs to be deleted
|
||||
|
||||
try {
|
||||
api_instance.deleteUser(username);
|
||||
} catch (e) {
|
||||
print("Exception when calling UserApi->deleteUser: $e\n");
|
||||
}
|
||||
```
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**username** | **String**| The name that needs to be deleted |
|
||||
|
||||
### Return type
|
||||
|
||||
void (empty response body)
|
||||
|
||||
### Authorization
|
||||
|
||||
No authorization required
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: application/xml, application/json
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
||||
|
||||
# **getUserByName**
|
||||
> User getUserByName(username)
|
||||
|
||||
Get user by user name
|
||||
|
||||
|
||||
|
||||
### Example
|
||||
```dart
|
||||
import 'package:swagger/api.dart';
|
||||
|
||||
var api_instance = new UserApi();
|
||||
var username = username_example; // String | The name that needs to be fetched. Use user1 for testing.
|
||||
|
||||
try {
|
||||
var result = api_instance.getUserByName(username);
|
||||
print(result);
|
||||
} catch (e) {
|
||||
print("Exception when calling UserApi->getUserByName: $e\n");
|
||||
}
|
||||
```
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**username** | **String**| The name that needs to be fetched. Use user1 for testing. |
|
||||
|
||||
### Return type
|
||||
|
||||
[**User**](User.md)
|
||||
|
||||
### Authorization
|
||||
|
||||
No authorization required
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: application/xml, application/json
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
||||
|
||||
# **loginUser**
|
||||
> String loginUser(username, password)
|
||||
|
||||
Logs user into the system
|
||||
|
||||
|
||||
|
||||
### Example
|
||||
```dart
|
||||
import 'package:swagger/api.dart';
|
||||
|
||||
var api_instance = new UserApi();
|
||||
var username = username_example; // String | The user name for login
|
||||
var password = password_example; // String | The password for login in clear text
|
||||
|
||||
try {
|
||||
var result = api_instance.loginUser(username, password);
|
||||
print(result);
|
||||
} catch (e) {
|
||||
print("Exception when calling UserApi->loginUser: $e\n");
|
||||
}
|
||||
```
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**username** | **String**| The user name for login |
|
||||
**password** | **String**| The password for login in clear text |
|
||||
|
||||
### Return type
|
||||
|
||||
**String**
|
||||
|
||||
### Authorization
|
||||
|
||||
No authorization required
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: application/xml, application/json
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
||||
|
||||
# **logoutUser**
|
||||
> logoutUser()
|
||||
|
||||
Logs out current logged in user session
|
||||
|
||||
|
||||
|
||||
### Example
|
||||
```dart
|
||||
import 'package:swagger/api.dart';
|
||||
|
||||
var api_instance = new UserApi();
|
||||
|
||||
try {
|
||||
api_instance.logoutUser();
|
||||
} catch (e) {
|
||||
print("Exception when calling UserApi->logoutUser: $e\n");
|
||||
}
|
||||
```
|
||||
|
||||
### Parameters
|
||||
This endpoint does not need any parameter.
|
||||
|
||||
### Return type
|
||||
|
||||
void (empty response body)
|
||||
|
||||
### Authorization
|
||||
|
||||
No authorization required
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: application/xml, application/json
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
||||
|
||||
# **updateUser**
|
||||
> updateUser(username, body)
|
||||
|
||||
Updated user
|
||||
|
||||
This can only be done by the logged in user.
|
||||
|
||||
### Example
|
||||
```dart
|
||||
import 'package:swagger/api.dart';
|
||||
|
||||
var api_instance = new UserApi();
|
||||
var username = username_example; // String | name that need to be deleted
|
||||
var body = new User(); // User | Updated user object
|
||||
|
||||
try {
|
||||
api_instance.updateUser(username, body);
|
||||
} catch (e) {
|
||||
print("Exception when calling UserApi->updateUser: $e\n");
|
||||
}
|
||||
```
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**username** | **String**| name that need to be deleted |
|
||||
**body** | [**User**](User.md)| Updated user object |
|
||||
|
||||
### Return type
|
||||
|
||||
void (empty response body)
|
||||
|
||||
### Authorization
|
||||
|
||||
No authorization required
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: application/xml, application/json
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
||||
|
@ -0,0 +1,52 @@
|
||||
#!/bin/sh
|
||||
# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/
|
||||
#
|
||||
# Usage example: /bin/sh ./git_push.sh wing328 swagger-petstore-perl "minor update"
|
||||
|
||||
git_user_id=$1
|
||||
git_repo_id=$2
|
||||
release_note=$3
|
||||
|
||||
if [ "$git_user_id" = "" ]; then
|
||||
git_user_id="GIT_USER_ID"
|
||||
echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id"
|
||||
fi
|
||||
|
||||
if [ "$git_repo_id" = "" ]; then
|
||||
git_repo_id="GIT_REPO_ID"
|
||||
echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id"
|
||||
fi
|
||||
|
||||
if [ "$release_note" = "" ]; then
|
||||
release_note="Minor update"
|
||||
echo "[INFO] No command line input provided. Set \$release_note to $release_note"
|
||||
fi
|
||||
|
||||
# Initialize the local directory as a Git repository
|
||||
git init
|
||||
|
||||
# Adds the files in the local repository and stages them for commit.
|
||||
git add .
|
||||
|
||||
# Commits the tracked changes and prepares them to be pushed to a remote repository.
|
||||
git commit -m "$release_note"
|
||||
|
||||
# Sets the new remote
|
||||
git_remote=`git remote`
|
||||
if [ "$git_remote" = "" ]; then # git remote not defined
|
||||
|
||||
if [ "$GIT_TOKEN" = "" ]; then
|
||||
echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment."
|
||||
git remote add origin https://github.com/${git_user_id}/${git_repo_id}.git
|
||||
else
|
||||
git remote add origin https://${git_user_id}:${GIT_TOKEN}@github.com/${git_user_id}/${git_repo_id}.git
|
||||
fi
|
||||
|
||||
fi
|
||||
|
||||
git pull origin master
|
||||
|
||||
# Pushes (Forces) the changes in the local repository up to the remote repository
|
||||
echo "Git pushing to https://github.com/${git_user_id}/${git_repo_id}.git"
|
||||
git push origin master 2>&1 | grep -v 'To https'
|
||||
|
@ -0,0 +1,27 @@
|
||||
library swagger.api;
|
||||
|
||||
import 'dart:async';
|
||||
import 'dart:convert';
|
||||
import 'package:http/http.dart';
|
||||
|
||||
part 'api_client.dart';
|
||||
part 'api_helper.dart';
|
||||
part 'api_exception.dart';
|
||||
part 'auth/authentication.dart';
|
||||
part 'auth/api_key_auth.dart';
|
||||
part 'auth/oauth.dart';
|
||||
part 'auth/http_basic_auth.dart';
|
||||
|
||||
part 'api/pet_api.dart';
|
||||
part 'api/store_api.dart';
|
||||
part 'api/user_api.dart';
|
||||
|
||||
part 'model/api_response.dart';
|
||||
part 'model/category.dart';
|
||||
part 'model/order.dart';
|
||||
part 'model/pet.dart';
|
||||
part 'model/tag.dart';
|
||||
part 'model/user.dart';
|
||||
|
||||
|
||||
ApiClient defaultApiClient = new ApiClient();
|
@ -0,0 +1,449 @@
|
||||
part of swagger.api;
|
||||
|
||||
|
||||
|
||||
class PetApi {
|
||||
final ApiClient apiClient;
|
||||
|
||||
PetApi([ApiClient apiClient]) : apiClient = apiClient ?? defaultApiClient;
|
||||
|
||||
/// Add a new pet to the store
|
||||
///
|
||||
///
|
||||
Future addPet(Pet body) async {
|
||||
Object postBody = body;
|
||||
|
||||
// verify required params are set
|
||||
if(body == null) {
|
||||
throw new ApiException(400, "Missing required param: body");
|
||||
}
|
||||
|
||||
// create path and map variables
|
||||
String path = "/pet".replaceAll("{format}","json");
|
||||
|
||||
// query params
|
||||
List<QueryParam> queryParams = [];
|
||||
Map<String, String> headerParams = {};
|
||||
Map<String, String> formParams = {};
|
||||
|
||||
List<String> contentTypes = ["application/json","application/xml"];
|
||||
|
||||
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
|
||||
List<String> authNames = ["petstore_auth"];
|
||||
|
||||
if(contentType.startsWith("multipart/form-data")) {
|
||||
bool hasFields = false;
|
||||
MultipartRequest mp = new MultipartRequest(null, null);
|
||||
|
||||
if(hasFields)
|
||||
postBody = mp;
|
||||
}
|
||||
else {
|
||||
}
|
||||
|
||||
var response = await apiClient.invokeAPI(path,
|
||||
'POST',
|
||||
queryParams,
|
||||
postBody,
|
||||
headerParams,
|
||||
formParams,
|
||||
contentType,
|
||||
authNames);
|
||||
|
||||
if(response.statusCode >= 400) {
|
||||
throw new ApiException(response.statusCode, response.body);
|
||||
} else if(response.body != null) {
|
||||
return ;
|
||||
} else {
|
||||
return ;
|
||||
}
|
||||
}
|
||||
/// Deletes a pet
|
||||
///
|
||||
///
|
||||
Future deletePet(int petId, { String apiKey }) async {
|
||||
Object postBody = null;
|
||||
|
||||
// verify required params are set
|
||||
if(petId == null) {
|
||||
throw new ApiException(400, "Missing required param: petId");
|
||||
}
|
||||
|
||||
// create path and map variables
|
||||
String path = "/pet/{petId}".replaceAll("{format}","json").replaceAll("{" + "petId" + "}", petId.toString());
|
||||
|
||||
// query params
|
||||
List<QueryParam> queryParams = [];
|
||||
Map<String, String> headerParams = {};
|
||||
Map<String, String> formParams = {};
|
||||
headerParams["api_key"] = apiKey;
|
||||
|
||||
List<String> contentTypes = [];
|
||||
|
||||
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
|
||||
List<String> authNames = ["petstore_auth"];
|
||||
|
||||
if(contentType.startsWith("multipart/form-data")) {
|
||||
bool hasFields = false;
|
||||
MultipartRequest mp = new MultipartRequest(null, null);
|
||||
|
||||
if(hasFields)
|
||||
postBody = mp;
|
||||
}
|
||||
else {
|
||||
}
|
||||
|
||||
var response = await apiClient.invokeAPI(path,
|
||||
'DELETE',
|
||||
queryParams,
|
||||
postBody,
|
||||
headerParams,
|
||||
formParams,
|
||||
contentType,
|
||||
authNames);
|
||||
|
||||
if(response.statusCode >= 400) {
|
||||
throw new ApiException(response.statusCode, response.body);
|
||||
} else if(response.body != null) {
|
||||
return ;
|
||||
} else {
|
||||
return ;
|
||||
}
|
||||
}
|
||||
/// Finds Pets by status
|
||||
///
|
||||
/// Multiple status values can be provided with comma separated strings
|
||||
Future<List<Pet>> findPetsByStatus(List<String> status) async {
|
||||
Object postBody = null;
|
||||
|
||||
// verify required params are set
|
||||
if(status == null) {
|
||||
throw new ApiException(400, "Missing required param: status");
|
||||
}
|
||||
|
||||
// create path and map variables
|
||||
String path = "/pet/findByStatus".replaceAll("{format}","json");
|
||||
|
||||
// query params
|
||||
List<QueryParam> queryParams = [];
|
||||
Map<String, String> headerParams = {};
|
||||
Map<String, String> formParams = {};
|
||||
queryParams.addAll(_convertParametersForCollectionFormat("csv", "status", status));
|
||||
|
||||
List<String> contentTypes = [];
|
||||
|
||||
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
|
||||
List<String> authNames = ["petstore_auth"];
|
||||
|
||||
if(contentType.startsWith("multipart/form-data")) {
|
||||
bool hasFields = false;
|
||||
MultipartRequest mp = new MultipartRequest(null, null);
|
||||
|
||||
if(hasFields)
|
||||
postBody = mp;
|
||||
}
|
||||
else {
|
||||
}
|
||||
|
||||
var response = await apiClient.invokeAPI(path,
|
||||
'GET',
|
||||
queryParams,
|
||||
postBody,
|
||||
headerParams,
|
||||
formParams,
|
||||
contentType,
|
||||
authNames);
|
||||
|
||||
if(response.statusCode >= 400) {
|
||||
throw new ApiException(response.statusCode, response.body);
|
||||
} else if(response.body != null) {
|
||||
return apiClient.deserialize(response.body, 'List<Pet>') as List<Pet> ;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
/// Finds Pets by tags
|
||||
///
|
||||
/// Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
|
||||
Future<List<Pet>> findPetsByTags(List<String> tags) async {
|
||||
Object postBody = null;
|
||||
|
||||
// verify required params are set
|
||||
if(tags == null) {
|
||||
throw new ApiException(400, "Missing required param: tags");
|
||||
}
|
||||
|
||||
// create path and map variables
|
||||
String path = "/pet/findByTags".replaceAll("{format}","json");
|
||||
|
||||
// query params
|
||||
List<QueryParam> queryParams = [];
|
||||
Map<String, String> headerParams = {};
|
||||
Map<String, String> formParams = {};
|
||||
queryParams.addAll(_convertParametersForCollectionFormat("csv", "tags", tags));
|
||||
|
||||
List<String> contentTypes = [];
|
||||
|
||||
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
|
||||
List<String> authNames = ["petstore_auth"];
|
||||
|
||||
if(contentType.startsWith("multipart/form-data")) {
|
||||
bool hasFields = false;
|
||||
MultipartRequest mp = new MultipartRequest(null, null);
|
||||
|
||||
if(hasFields)
|
||||
postBody = mp;
|
||||
}
|
||||
else {
|
||||
}
|
||||
|
||||
var response = await apiClient.invokeAPI(path,
|
||||
'GET',
|
||||
queryParams,
|
||||
postBody,
|
||||
headerParams,
|
||||
formParams,
|
||||
contentType,
|
||||
authNames);
|
||||
|
||||
if(response.statusCode >= 400) {
|
||||
throw new ApiException(response.statusCode, response.body);
|
||||
} else if(response.body != null) {
|
||||
return apiClient.deserialize(response.body, 'List<Pet>') as List<Pet> ;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
/// Find pet by ID
|
||||
///
|
||||
/// Returns a single pet
|
||||
Future<Pet> getPetById(int petId) async {
|
||||
Object postBody = null;
|
||||
|
||||
// verify required params are set
|
||||
if(petId == null) {
|
||||
throw new ApiException(400, "Missing required param: petId");
|
||||
}
|
||||
|
||||
// create path and map variables
|
||||
String path = "/pet/{petId}".replaceAll("{format}","json").replaceAll("{" + "petId" + "}", petId.toString());
|
||||
|
||||
// query params
|
||||
List<QueryParam> queryParams = [];
|
||||
Map<String, String> headerParams = {};
|
||||
Map<String, String> formParams = {};
|
||||
|
||||
List<String> contentTypes = [];
|
||||
|
||||
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
|
||||
List<String> authNames = ["api_key"];
|
||||
|
||||
if(contentType.startsWith("multipart/form-data")) {
|
||||
bool hasFields = false;
|
||||
MultipartRequest mp = new MultipartRequest(null, null);
|
||||
|
||||
if(hasFields)
|
||||
postBody = mp;
|
||||
}
|
||||
else {
|
||||
}
|
||||
|
||||
var response = await apiClient.invokeAPI(path,
|
||||
'GET',
|
||||
queryParams,
|
||||
postBody,
|
||||
headerParams,
|
||||
formParams,
|
||||
contentType,
|
||||
authNames);
|
||||
|
||||
if(response.statusCode >= 400) {
|
||||
throw new ApiException(response.statusCode, response.body);
|
||||
} else if(response.body != null) {
|
||||
return apiClient.deserialize(response.body, 'Pet') as Pet ;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
/// Update an existing pet
|
||||
///
|
||||
///
|
||||
Future updatePet(Pet body) async {
|
||||
Object postBody = body;
|
||||
|
||||
// verify required params are set
|
||||
if(body == null) {
|
||||
throw new ApiException(400, "Missing required param: body");
|
||||
}
|
||||
|
||||
// create path and map variables
|
||||
String path = "/pet".replaceAll("{format}","json");
|
||||
|
||||
// query params
|
||||
List<QueryParam> queryParams = [];
|
||||
Map<String, String> headerParams = {};
|
||||
Map<String, String> formParams = {};
|
||||
|
||||
List<String> contentTypes = ["application/json","application/xml"];
|
||||
|
||||
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
|
||||
List<String> authNames = ["petstore_auth"];
|
||||
|
||||
if(contentType.startsWith("multipart/form-data")) {
|
||||
bool hasFields = false;
|
||||
MultipartRequest mp = new MultipartRequest(null, null);
|
||||
|
||||
if(hasFields)
|
||||
postBody = mp;
|
||||
}
|
||||
else {
|
||||
}
|
||||
|
||||
var response = await apiClient.invokeAPI(path,
|
||||
'PUT',
|
||||
queryParams,
|
||||
postBody,
|
||||
headerParams,
|
||||
formParams,
|
||||
contentType,
|
||||
authNames);
|
||||
|
||||
if(response.statusCode >= 400) {
|
||||
throw new ApiException(response.statusCode, response.body);
|
||||
} else if(response.body != null) {
|
||||
return ;
|
||||
} else {
|
||||
return ;
|
||||
}
|
||||
}
|
||||
/// Updates a pet in the store with form data
|
||||
///
|
||||
///
|
||||
Future updatePetWithForm(int petId, { String name, String status }) async {
|
||||
Object postBody = null;
|
||||
|
||||
// verify required params are set
|
||||
if(petId == null) {
|
||||
throw new ApiException(400, "Missing required param: petId");
|
||||
}
|
||||
|
||||
// create path and map variables
|
||||
String path = "/pet/{petId}".replaceAll("{format}","json").replaceAll("{" + "petId" + "}", petId.toString());
|
||||
|
||||
// query params
|
||||
List<QueryParam> queryParams = [];
|
||||
Map<String, String> headerParams = {};
|
||||
Map<String, String> formParams = {};
|
||||
|
||||
List<String> contentTypes = ["application/x-www-form-urlencoded"];
|
||||
|
||||
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
|
||||
List<String> authNames = ["petstore_auth"];
|
||||
|
||||
if(contentType.startsWith("multipart/form-data")) {
|
||||
bool hasFields = false;
|
||||
MultipartRequest mp = new MultipartRequest(null, null);
|
||||
|
||||
if (name != null) {
|
||||
hasFields = true;
|
||||
mp.fields['name'] = parameterToString(name);
|
||||
}
|
||||
|
||||
if (status != null) {
|
||||
hasFields = true;
|
||||
mp.fields['status'] = parameterToString(status);
|
||||
}
|
||||
|
||||
if(hasFields)
|
||||
postBody = mp;
|
||||
}
|
||||
else {
|
||||
if (name != null)
|
||||
formParams['name'] = parameterToString(name);
|
||||
if (status != null)
|
||||
formParams['status'] = parameterToString(status);
|
||||
}
|
||||
|
||||
var response = await apiClient.invokeAPI(path,
|
||||
'POST',
|
||||
queryParams,
|
||||
postBody,
|
||||
headerParams,
|
||||
formParams,
|
||||
contentType,
|
||||
authNames);
|
||||
|
||||
if(response.statusCode >= 400) {
|
||||
throw new ApiException(response.statusCode, response.body);
|
||||
} else if(response.body != null) {
|
||||
return ;
|
||||
} else {
|
||||
return ;
|
||||
}
|
||||
}
|
||||
/// uploads an image
|
||||
///
|
||||
///
|
||||
Future<ApiResponse> uploadFile(int petId, { String additionalMetadata, MultipartFile file }) async {
|
||||
Object postBody = null;
|
||||
|
||||
// verify required params are set
|
||||
if(petId == null) {
|
||||
throw new ApiException(400, "Missing required param: petId");
|
||||
}
|
||||
|
||||
// create path and map variables
|
||||
String path = "/pet/{petId}/uploadImage".replaceAll("{format}","json").replaceAll("{" + "petId" + "}", petId.toString());
|
||||
|
||||
// query params
|
||||
List<QueryParam> queryParams = [];
|
||||
Map<String, String> headerParams = {};
|
||||
Map<String, String> formParams = {};
|
||||
|
||||
List<String> contentTypes = ["multipart/form-data"];
|
||||
|
||||
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
|
||||
List<String> authNames = ["petstore_auth"];
|
||||
|
||||
if(contentType.startsWith("multipart/form-data")) {
|
||||
bool hasFields = false;
|
||||
MultipartRequest mp = new MultipartRequest(null, null);
|
||||
|
||||
if (additionalMetadata != null) {
|
||||
hasFields = true;
|
||||
mp.fields['additionalMetadata'] = parameterToString(additionalMetadata);
|
||||
}
|
||||
|
||||
if (file != null) {
|
||||
hasFields = true;
|
||||
mp.fields['file'] = file.field;
|
||||
mp.files.add(file);
|
||||
}
|
||||
|
||||
if(hasFields)
|
||||
postBody = mp;
|
||||
}
|
||||
else {
|
||||
if (additionalMetadata != null)
|
||||
formParams['additionalMetadata'] = parameterToString(additionalMetadata);
|
||||
|
||||
}
|
||||
|
||||
var response = await apiClient.invokeAPI(path,
|
||||
'POST',
|
||||
queryParams,
|
||||
postBody,
|
||||
headerParams,
|
||||
formParams,
|
||||
contentType,
|
||||
authNames);
|
||||
|
||||
if(response.statusCode >= 400) {
|
||||
throw new ApiException(response.statusCode, response.body);
|
||||
} else if(response.body != null) {
|
||||
return apiClient.deserialize(response.body, 'ApiResponse') as ApiResponse ;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,211 @@
|
||||
part of swagger.api;
|
||||
|
||||
|
||||
|
||||
class StoreApi {
|
||||
final ApiClient apiClient;
|
||||
|
||||
StoreApi([ApiClient apiClient]) : apiClient = apiClient ?? defaultApiClient;
|
||||
|
||||
/// Delete purchase order by ID
|
||||
///
|
||||
/// For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors
|
||||
Future deleteOrder(String orderId) async {
|
||||
Object postBody = null;
|
||||
|
||||
// verify required params are set
|
||||
if(orderId == null) {
|
||||
throw new ApiException(400, "Missing required param: orderId");
|
||||
}
|
||||
|
||||
// create path and map variables
|
||||
String path = "/store/order/{orderId}".replaceAll("{format}","json").replaceAll("{" + "orderId" + "}", orderId.toString());
|
||||
|
||||
// query params
|
||||
List<QueryParam> queryParams = [];
|
||||
Map<String, String> headerParams = {};
|
||||
Map<String, String> formParams = {};
|
||||
|
||||
List<String> contentTypes = [];
|
||||
|
||||
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
|
||||
List<String> authNames = [];
|
||||
|
||||
if(contentType.startsWith("multipart/form-data")) {
|
||||
bool hasFields = false;
|
||||
MultipartRequest mp = new MultipartRequest(null, null);
|
||||
|
||||
if(hasFields)
|
||||
postBody = mp;
|
||||
}
|
||||
else {
|
||||
}
|
||||
|
||||
var response = await apiClient.invokeAPI(path,
|
||||
'DELETE',
|
||||
queryParams,
|
||||
postBody,
|
||||
headerParams,
|
||||
formParams,
|
||||
contentType,
|
||||
authNames);
|
||||
|
||||
if(response.statusCode >= 400) {
|
||||
throw new ApiException(response.statusCode, response.body);
|
||||
} else if(response.body != null) {
|
||||
return ;
|
||||
} else {
|
||||
return ;
|
||||
}
|
||||
}
|
||||
/// Returns pet inventories by status
|
||||
///
|
||||
/// Returns a map of status codes to quantities
|
||||
Future<Map<String, int>> getInventory() async {
|
||||
Object postBody = null;
|
||||
|
||||
// verify required params are set
|
||||
|
||||
// create path and map variables
|
||||
String path = "/store/inventory".replaceAll("{format}","json");
|
||||
|
||||
// query params
|
||||
List<QueryParam> queryParams = [];
|
||||
Map<String, String> headerParams = {};
|
||||
Map<String, String> formParams = {};
|
||||
|
||||
List<String> contentTypes = [];
|
||||
|
||||
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
|
||||
List<String> authNames = ["api_key"];
|
||||
|
||||
if(contentType.startsWith("multipart/form-data")) {
|
||||
bool hasFields = false;
|
||||
MultipartRequest mp = new MultipartRequest(null, null);
|
||||
|
||||
if(hasFields)
|
||||
postBody = mp;
|
||||
}
|
||||
else {
|
||||
}
|
||||
|
||||
var response = await apiClient.invokeAPI(path,
|
||||
'GET',
|
||||
queryParams,
|
||||
postBody,
|
||||
headerParams,
|
||||
formParams,
|
||||
contentType,
|
||||
authNames);
|
||||
|
||||
if(response.statusCode >= 400) {
|
||||
throw new ApiException(response.statusCode, response.body);
|
||||
} else if(response.body != null) {
|
||||
return apiClient.deserialize(response.body, 'Map<String, int>') as Map<String, int> ;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
/// Find purchase order by ID
|
||||
///
|
||||
/// For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions
|
||||
Future<Order> getOrderById(int orderId) async {
|
||||
Object postBody = null;
|
||||
|
||||
// verify required params are set
|
||||
if(orderId == null) {
|
||||
throw new ApiException(400, "Missing required param: orderId");
|
||||
}
|
||||
|
||||
// create path and map variables
|
||||
String path = "/store/order/{orderId}".replaceAll("{format}","json").replaceAll("{" + "orderId" + "}", orderId.toString());
|
||||
|
||||
// query params
|
||||
List<QueryParam> queryParams = [];
|
||||
Map<String, String> headerParams = {};
|
||||
Map<String, String> formParams = {};
|
||||
|
||||
List<String> contentTypes = [];
|
||||
|
||||
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
|
||||
List<String> authNames = [];
|
||||
|
||||
if(contentType.startsWith("multipart/form-data")) {
|
||||
bool hasFields = false;
|
||||
MultipartRequest mp = new MultipartRequest(null, null);
|
||||
|
||||
if(hasFields)
|
||||
postBody = mp;
|
||||
}
|
||||
else {
|
||||
}
|
||||
|
||||
var response = await apiClient.invokeAPI(path,
|
||||
'GET',
|
||||
queryParams,
|
||||
postBody,
|
||||
headerParams,
|
||||
formParams,
|
||||
contentType,
|
||||
authNames);
|
||||
|
||||
if(response.statusCode >= 400) {
|
||||
throw new ApiException(response.statusCode, response.body);
|
||||
} else if(response.body != null) {
|
||||
return apiClient.deserialize(response.body, 'Order') as Order ;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
/// Place an order for a pet
|
||||
///
|
||||
///
|
||||
Future<Order> placeOrder(Order body) async {
|
||||
Object postBody = body;
|
||||
|
||||
// verify required params are set
|
||||
if(body == null) {
|
||||
throw new ApiException(400, "Missing required param: body");
|
||||
}
|
||||
|
||||
// create path and map variables
|
||||
String path = "/store/order".replaceAll("{format}","json");
|
||||
|
||||
// query params
|
||||
List<QueryParam> queryParams = [];
|
||||
Map<String, String> headerParams = {};
|
||||
Map<String, String> formParams = {};
|
||||
|
||||
List<String> contentTypes = [];
|
||||
|
||||
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
|
||||
List<String> authNames = [];
|
||||
|
||||
if(contentType.startsWith("multipart/form-data")) {
|
||||
bool hasFields = false;
|
||||
MultipartRequest mp = new MultipartRequest(null, null);
|
||||
|
||||
if(hasFields)
|
||||
postBody = mp;
|
||||
}
|
||||
else {
|
||||
}
|
||||
|
||||
var response = await apiClient.invokeAPI(path,
|
||||
'POST',
|
||||
queryParams,
|
||||
postBody,
|
||||
headerParams,
|
||||
formParams,
|
||||
contentType,
|
||||
authNames);
|
||||
|
||||
if(response.statusCode >= 400) {
|
||||
throw new ApiException(response.statusCode, response.body);
|
||||
} else if(response.body != null) {
|
||||
return apiClient.deserialize(response.body, 'Order') as Order ;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,423 @@
|
||||
part of swagger.api;
|
||||
|
||||
|
||||
|
||||
class UserApi {
|
||||
final ApiClient apiClient;
|
||||
|
||||
UserApi([ApiClient apiClient]) : apiClient = apiClient ?? defaultApiClient;
|
||||
|
||||
/// Create user
|
||||
///
|
||||
/// This can only be done by the logged in user.
|
||||
Future createUser(User body) async {
|
||||
Object postBody = body;
|
||||
|
||||
// verify required params are set
|
||||
if(body == null) {
|
||||
throw new ApiException(400, "Missing required param: body");
|
||||
}
|
||||
|
||||
// create path and map variables
|
||||
String path = "/user".replaceAll("{format}","json");
|
||||
|
||||
// query params
|
||||
List<QueryParam> queryParams = [];
|
||||
Map<String, String> headerParams = {};
|
||||
Map<String, String> formParams = {};
|
||||
|
||||
List<String> contentTypes = [];
|
||||
|
||||
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
|
||||
List<String> authNames = [];
|
||||
|
||||
if(contentType.startsWith("multipart/form-data")) {
|
||||
bool hasFields = false;
|
||||
MultipartRequest mp = new MultipartRequest(null, null);
|
||||
|
||||
if(hasFields)
|
||||
postBody = mp;
|
||||
}
|
||||
else {
|
||||
}
|
||||
|
||||
var response = await apiClient.invokeAPI(path,
|
||||
'POST',
|
||||
queryParams,
|
||||
postBody,
|
||||
headerParams,
|
||||
formParams,
|
||||
contentType,
|
||||
authNames);
|
||||
|
||||
if(response.statusCode >= 400) {
|
||||
throw new ApiException(response.statusCode, response.body);
|
||||
} else if(response.body != null) {
|
||||
return ;
|
||||
} else {
|
||||
return ;
|
||||
}
|
||||
}
|
||||
/// Creates list of users with given input array
|
||||
///
|
||||
///
|
||||
Future createUsersWithArrayInput(List<User> body) async {
|
||||
Object postBody = body;
|
||||
|
||||
// verify required params are set
|
||||
if(body == null) {
|
||||
throw new ApiException(400, "Missing required param: body");
|
||||
}
|
||||
|
||||
// create path and map variables
|
||||
String path = "/user/createWithArray".replaceAll("{format}","json");
|
||||
|
||||
// query params
|
||||
List<QueryParam> queryParams = [];
|
||||
Map<String, String> headerParams = {};
|
||||
Map<String, String> formParams = {};
|
||||
|
||||
List<String> contentTypes = [];
|
||||
|
||||
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
|
||||
List<String> authNames = [];
|
||||
|
||||
if(contentType.startsWith("multipart/form-data")) {
|
||||
bool hasFields = false;
|
||||
MultipartRequest mp = new MultipartRequest(null, null);
|
||||
|
||||
if(hasFields)
|
||||
postBody = mp;
|
||||
}
|
||||
else {
|
||||
}
|
||||
|
||||
var response = await apiClient.invokeAPI(path,
|
||||
'POST',
|
||||
queryParams,
|
||||
postBody,
|
||||
headerParams,
|
||||
formParams,
|
||||
contentType,
|
||||
authNames);
|
||||
|
||||
if(response.statusCode >= 400) {
|
||||
throw new ApiException(response.statusCode, response.body);
|
||||
} else if(response.body != null) {
|
||||
return ;
|
||||
} else {
|
||||
return ;
|
||||
}
|
||||
}
|
||||
/// Creates list of users with given input array
|
||||
///
|
||||
///
|
||||
Future createUsersWithListInput(List<User> body) async {
|
||||
Object postBody = body;
|
||||
|
||||
// verify required params are set
|
||||
if(body == null) {
|
||||
throw new ApiException(400, "Missing required param: body");
|
||||
}
|
||||
|
||||
// create path and map variables
|
||||
String path = "/user/createWithList".replaceAll("{format}","json");
|
||||
|
||||
// query params
|
||||
List<QueryParam> queryParams = [];
|
||||
Map<String, String> headerParams = {};
|
||||
Map<String, String> formParams = {};
|
||||
|
||||
List<String> contentTypes = [];
|
||||
|
||||
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
|
||||
List<String> authNames = [];
|
||||
|
||||
if(contentType.startsWith("multipart/form-data")) {
|
||||
bool hasFields = false;
|
||||
MultipartRequest mp = new MultipartRequest(null, null);
|
||||
|
||||
if(hasFields)
|
||||
postBody = mp;
|
||||
}
|
||||
else {
|
||||
}
|
||||
|
||||
var response = await apiClient.invokeAPI(path,
|
||||
'POST',
|
||||
queryParams,
|
||||
postBody,
|
||||
headerParams,
|
||||
formParams,
|
||||
contentType,
|
||||
authNames);
|
||||
|
||||
if(response.statusCode >= 400) {
|
||||
throw new ApiException(response.statusCode, response.body);
|
||||
} else if(response.body != null) {
|
||||
return ;
|
||||
} else {
|
||||
return ;
|
||||
}
|
||||
}
|
||||
/// Delete user
|
||||
///
|
||||
/// This can only be done by the logged in user.
|
||||
Future deleteUser(String username) async {
|
||||
Object postBody = null;
|
||||
|
||||
// verify required params are set
|
||||
if(username == null) {
|
||||
throw new ApiException(400, "Missing required param: username");
|
||||
}
|
||||
|
||||
// create path and map variables
|
||||
String path = "/user/{username}".replaceAll("{format}","json").replaceAll("{" + "username" + "}", username.toString());
|
||||
|
||||
// query params
|
||||
List<QueryParam> queryParams = [];
|
||||
Map<String, String> headerParams = {};
|
||||
Map<String, String> formParams = {};
|
||||
|
||||
List<String> contentTypes = [];
|
||||
|
||||
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
|
||||
List<String> authNames = [];
|
||||
|
||||
if(contentType.startsWith("multipart/form-data")) {
|
||||
bool hasFields = false;
|
||||
MultipartRequest mp = new MultipartRequest(null, null);
|
||||
|
||||
if(hasFields)
|
||||
postBody = mp;
|
||||
}
|
||||
else {
|
||||
}
|
||||
|
||||
var response = await apiClient.invokeAPI(path,
|
||||
'DELETE',
|
||||
queryParams,
|
||||
postBody,
|
||||
headerParams,
|
||||
formParams,
|
||||
contentType,
|
||||
authNames);
|
||||
|
||||
if(response.statusCode >= 400) {
|
||||
throw new ApiException(response.statusCode, response.body);
|
||||
} else if(response.body != null) {
|
||||
return ;
|
||||
} else {
|
||||
return ;
|
||||
}
|
||||
}
|
||||
/// Get user by user name
|
||||
///
|
||||
///
|
||||
Future<User> getUserByName(String username) async {
|
||||
Object postBody = null;
|
||||
|
||||
// verify required params are set
|
||||
if(username == null) {
|
||||
throw new ApiException(400, "Missing required param: username");
|
||||
}
|
||||
|
||||
// create path and map variables
|
||||
String path = "/user/{username}".replaceAll("{format}","json").replaceAll("{" + "username" + "}", username.toString());
|
||||
|
||||
// query params
|
||||
List<QueryParam> queryParams = [];
|
||||
Map<String, String> headerParams = {};
|
||||
Map<String, String> formParams = {};
|
||||
|
||||
List<String> contentTypes = [];
|
||||
|
||||
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
|
||||
List<String> authNames = [];
|
||||
|
||||
if(contentType.startsWith("multipart/form-data")) {
|
||||
bool hasFields = false;
|
||||
MultipartRequest mp = new MultipartRequest(null, null);
|
||||
|
||||
if(hasFields)
|
||||
postBody = mp;
|
||||
}
|
||||
else {
|
||||
}
|
||||
|
||||
var response = await apiClient.invokeAPI(path,
|
||||
'GET',
|
||||
queryParams,
|
||||
postBody,
|
||||
headerParams,
|
||||
formParams,
|
||||
contentType,
|
||||
authNames);
|
||||
|
||||
if(response.statusCode >= 400) {
|
||||
throw new ApiException(response.statusCode, response.body);
|
||||
} else if(response.body != null) {
|
||||
return apiClient.deserialize(response.body, 'User') as User ;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
/// Logs user into the system
|
||||
///
|
||||
///
|
||||
Future<String> loginUser(String username, String password) async {
|
||||
Object postBody = null;
|
||||
|
||||
// verify required params are set
|
||||
if(username == null) {
|
||||
throw new ApiException(400, "Missing required param: username");
|
||||
}
|
||||
if(password == null) {
|
||||
throw new ApiException(400, "Missing required param: password");
|
||||
}
|
||||
|
||||
// create path and map variables
|
||||
String path = "/user/login".replaceAll("{format}","json");
|
||||
|
||||
// query params
|
||||
List<QueryParam> queryParams = [];
|
||||
Map<String, String> headerParams = {};
|
||||
Map<String, String> formParams = {};
|
||||
queryParams.addAll(_convertParametersForCollectionFormat("", "username", username));
|
||||
queryParams.addAll(_convertParametersForCollectionFormat("", "password", password));
|
||||
|
||||
List<String> contentTypes = [];
|
||||
|
||||
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
|
||||
List<String> authNames = [];
|
||||
|
||||
if(contentType.startsWith("multipart/form-data")) {
|
||||
bool hasFields = false;
|
||||
MultipartRequest mp = new MultipartRequest(null, null);
|
||||
|
||||
if(hasFields)
|
||||
postBody = mp;
|
||||
}
|
||||
else {
|
||||
}
|
||||
|
||||
var response = await apiClient.invokeAPI(path,
|
||||
'GET',
|
||||
queryParams,
|
||||
postBody,
|
||||
headerParams,
|
||||
formParams,
|
||||
contentType,
|
||||
authNames);
|
||||
|
||||
if(response.statusCode >= 400) {
|
||||
throw new ApiException(response.statusCode, response.body);
|
||||
} else if(response.body != null) {
|
||||
return apiClient.deserialize(response.body, 'String') as String ;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
/// Logs out current logged in user session
|
||||
///
|
||||
///
|
||||
Future logoutUser() async {
|
||||
Object postBody = null;
|
||||
|
||||
// verify required params are set
|
||||
|
||||
// create path and map variables
|
||||
String path = "/user/logout".replaceAll("{format}","json");
|
||||
|
||||
// query params
|
||||
List<QueryParam> queryParams = [];
|
||||
Map<String, String> headerParams = {};
|
||||
Map<String, String> formParams = {};
|
||||
|
||||
List<String> contentTypes = [];
|
||||
|
||||
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
|
||||
List<String> authNames = [];
|
||||
|
||||
if(contentType.startsWith("multipart/form-data")) {
|
||||
bool hasFields = false;
|
||||
MultipartRequest mp = new MultipartRequest(null, null);
|
||||
|
||||
if(hasFields)
|
||||
postBody = mp;
|
||||
}
|
||||
else {
|
||||
}
|
||||
|
||||
var response = await apiClient.invokeAPI(path,
|
||||
'GET',
|
||||
queryParams,
|
||||
postBody,
|
||||
headerParams,
|
||||
formParams,
|
||||
contentType,
|
||||
authNames);
|
||||
|
||||
if(response.statusCode >= 400) {
|
||||
throw new ApiException(response.statusCode, response.body);
|
||||
} else if(response.body != null) {
|
||||
return ;
|
||||
} else {
|
||||
return ;
|
||||
}
|
||||
}
|
||||
/// Updated user
|
||||
///
|
||||
/// This can only be done by the logged in user.
|
||||
Future updateUser(String username, User body) async {
|
||||
Object postBody = body;
|
||||
|
||||
// verify required params are set
|
||||
if(username == null) {
|
||||
throw new ApiException(400, "Missing required param: username");
|
||||
}
|
||||
if(body == null) {
|
||||
throw new ApiException(400, "Missing required param: body");
|
||||
}
|
||||
|
||||
// create path and map variables
|
||||
String path = "/user/{username}".replaceAll("{format}","json").replaceAll("{" + "username" + "}", username.toString());
|
||||
|
||||
// query params
|
||||
List<QueryParam> queryParams = [];
|
||||
Map<String, String> headerParams = {};
|
||||
Map<String, String> formParams = {};
|
||||
|
||||
List<String> contentTypes = [];
|
||||
|
||||
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
|
||||
List<String> authNames = [];
|
||||
|
||||
if(contentType.startsWith("multipart/form-data")) {
|
||||
bool hasFields = false;
|
||||
MultipartRequest mp = new MultipartRequest(null, null);
|
||||
|
||||
if(hasFields)
|
||||
postBody = mp;
|
||||
}
|
||||
else {
|
||||
}
|
||||
|
||||
var response = await apiClient.invokeAPI(path,
|
||||
'PUT',
|
||||
queryParams,
|
||||
postBody,
|
||||
headerParams,
|
||||
formParams,
|
||||
contentType,
|
||||
authNames);
|
||||
|
||||
if(response.statusCode >= 400) {
|
||||
throw new ApiException(response.statusCode, response.body);
|
||||
} else if(response.body != null) {
|
||||
return ;
|
||||
} else {
|
||||
return ;
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,152 @@
|
||||
part of swagger.api;
|
||||
|
||||
class QueryParam {
|
||||
String name;
|
||||
String value;
|
||||
|
||||
QueryParam(this.name, this.value);
|
||||
}
|
||||
|
||||
class ApiClient {
|
||||
|
||||
String basePath;
|
||||
var client = new Client();
|
||||
|
||||
Map<String, String> _defaultHeaderMap = {};
|
||||
Map<String, Authentication> _authentications = {};
|
||||
|
||||
final _RegList = new RegExp(r'^List<(.*)>$');
|
||||
final _RegMap = new RegExp(r'^Map<String,(.*)>$');
|
||||
|
||||
ApiClient({this.basePath: "http://petstore.swagger.io/v2"}) {
|
||||
// Setup authentications (key: authentication name, value: authentication).
|
||||
_authentications['api_key'] = new ApiKeyAuth("header", "api_key");
|
||||
_authentications['petstore_auth'] = new OAuth();
|
||||
}
|
||||
|
||||
void addDefaultHeader(String key, String value) {
|
||||
_defaultHeaderMap[key] = value;
|
||||
}
|
||||
|
||||
dynamic _deserialize(dynamic value, String targetType) {
|
||||
try {
|
||||
switch (targetType) {
|
||||
case 'String':
|
||||
return '$value';
|
||||
case 'int':
|
||||
return value is int ? value : int.parse('$value');
|
||||
case 'bool':
|
||||
return value is bool ? value : '$value'.toLowerCase() == 'true';
|
||||
case 'double':
|
||||
return value is double ? value : double.parse('$value');
|
||||
case 'ApiResponse':
|
||||
return new ApiResponse.fromJson(value);
|
||||
case 'Category':
|
||||
return new Category.fromJson(value);
|
||||
case 'Order':
|
||||
return new Order.fromJson(value);
|
||||
case 'Pet':
|
||||
return new Pet.fromJson(value);
|
||||
case 'Tag':
|
||||
return new Tag.fromJson(value);
|
||||
case 'User':
|
||||
return new User.fromJson(value);
|
||||
default:
|
||||
{
|
||||
Match match;
|
||||
if (value is List &&
|
||||
(match = _RegList.firstMatch(targetType)) != null) {
|
||||
var newTargetType = match[1];
|
||||
return value.map((v) => _deserialize(v, newTargetType)).toList();
|
||||
} else if (value is Map &&
|
||||
(match = _RegMap.firstMatch(targetType)) != null) {
|
||||
var newTargetType = match[1];
|
||||
return new Map.fromIterables(value.keys,
|
||||
value.values.map((v) => _deserialize(v, newTargetType)));
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (e, stack) {
|
||||
throw new ApiException.withInner(500, 'Exception during deserialization.', e, stack);
|
||||
}
|
||||
throw new ApiException(500, 'Could not find a suitable class for deserialization');
|
||||
}
|
||||
|
||||
dynamic deserialize(String json, String targetType) {
|
||||
// Remove all spaces. Necessary for reg expressions as well.
|
||||
targetType = targetType.replaceAll(' ', '');
|
||||
|
||||
if (targetType == 'String') return json;
|
||||
|
||||
var decodedJson = JSON.decode(json);
|
||||
return _deserialize(decodedJson, targetType);
|
||||
}
|
||||
|
||||
String serialize(Object obj) {
|
||||
String serialized = '';
|
||||
if (obj == null) {
|
||||
serialized = '';
|
||||
} else {
|
||||
serialized = JSON.encode(obj);
|
||||
}
|
||||
return serialized;
|
||||
}
|
||||
|
||||
// We don't use a Map<String, String> for queryParams.
|
||||
// If collectionFormat is 'multi' a key might appear multiple times.
|
||||
Future<Response> invokeAPI(String path,
|
||||
String method,
|
||||
Iterable<QueryParam> queryParams,
|
||||
Object body,
|
||||
Map<String, String> headerParams,
|
||||
Map<String, String> formParams,
|
||||
String contentType,
|
||||
List<String> authNames) async {
|
||||
|
||||
_updateParamsForAuth(authNames, queryParams, headerParams);
|
||||
|
||||
var ps = queryParams.where((p) => p.value != null).map((p) => '${p.name}=${p.value}');
|
||||
String queryString = ps.isNotEmpty ?
|
||||
'?' + ps.join('&') :
|
||||
'';
|
||||
|
||||
String url = basePath + path + queryString;
|
||||
|
||||
headerParams.addAll(_defaultHeaderMap);
|
||||
headerParams['Content-Type'] = contentType;
|
||||
|
||||
if(body is MultipartRequest) {
|
||||
var request = new MultipartRequest(method, Uri.parse(url));
|
||||
request.fields.addAll(body.fields);
|
||||
request.files.addAll(body.files);
|
||||
request.headers.addAll(body.headers);
|
||||
request.headers.addAll(headerParams);
|
||||
var response = await client.send(request);
|
||||
return Response.fromStream(response);
|
||||
} else {
|
||||
var msgBody = contentType == "application/x-www-form-urlencoded" ? formParams : serialize(body);
|
||||
switch(method) {
|
||||
case "POST":
|
||||
return client.post(url, headers: headerParams, body: msgBody);
|
||||
case "PUT":
|
||||
return client.put(url, headers: headerParams, body: msgBody);
|
||||
case "DELETE":
|
||||
return client.delete(url, headers: headerParams);
|
||||
case "PATCH":
|
||||
return client.patch(url, headers: headerParams, body: msgBody);
|
||||
default:
|
||||
return client.get(url, headers: headerParams);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Update query and header parameters based on authentication settings.
|
||||
/// @param authNames The authentications to apply
|
||||
void _updateParamsForAuth(List<String> authNames, List<QueryParam> queryParams, Map<String, String> headerParams) {
|
||||
authNames.forEach((authName) {
|
||||
Authentication auth = _authentications[authName];
|
||||
if (auth == null) throw new ArgumentError("Authentication undefined: " + authName);
|
||||
auth.applyToParams(queryParams, headerParams);
|
||||
});
|
||||
}
|
||||
}
|
@ -0,0 +1,23 @@
|
||||
part of swagger.api;
|
||||
|
||||
class ApiException implements Exception {
|
||||
int code = 0;
|
||||
String message = null;
|
||||
Exception innerException = null;
|
||||
StackTrace stackTrace = null;
|
||||
|
||||
ApiException(this.code, this.message);
|
||||
|
||||
ApiException.withInner(this.code, this.message, this.innerException, this.stackTrace);
|
||||
|
||||
String toString() {
|
||||
if (message == null) return "ApiException";
|
||||
|
||||
if (innerException == null) {
|
||||
return "ApiException $code: $message";
|
||||
}
|
||||
|
||||
return "ApiException $code: $message (Inner exception: ${innerException})\n\n" +
|
||||
stackTrace.toString();
|
||||
}
|
||||
}
|
@ -0,0 +1,44 @@
|
||||
part of swagger.api;
|
||||
|
||||
const _delimiters = const {'csv': ',', 'ssv': ' ', 'tsv': '\t', 'pipes': '|'};
|
||||
|
||||
// port from Java version
|
||||
Iterable<QueryParam> _convertParametersForCollectionFormat(
|
||||
String collectionFormat, String name, dynamic value) {
|
||||
var params = <QueryParam>[];
|
||||
|
||||
// preconditions
|
||||
if (name == null || name.isEmpty || value == null) return params;
|
||||
|
||||
if (value is! List) {
|
||||
params.add(new QueryParam(name, parameterToString(value)));
|
||||
return params;
|
||||
}
|
||||
|
||||
List values = value as List;
|
||||
|
||||
// get the collection format
|
||||
collectionFormat = (collectionFormat == null || collectionFormat.isEmpty)
|
||||
? "csv"
|
||||
: collectionFormat; // default: csv
|
||||
|
||||
if (collectionFormat == "multi") {
|
||||
return values.map((v) => new QueryParam(name, parameterToString(v)));
|
||||
}
|
||||
|
||||
String delimiter = _delimiters[collectionFormat] ?? ",";
|
||||
|
||||
params.add(new QueryParam(name, values.map((v) => parameterToString(v)).join(delimiter)));
|
||||
return params;
|
||||
}
|
||||
|
||||
/// Format the given parameter object into string.
|
||||
String parameterToString(dynamic value) {
|
||||
if (value == null) {
|
||||
return '';
|
||||
} else if (value is DateTime) {
|
||||
return value.toUtc().toIso8601String();
|
||||
} else {
|
||||
return value.toString();
|
||||
}
|
||||
}
|
@ -0,0 +1,27 @@
|
||||
part of swagger.api;
|
||||
|
||||
class ApiKeyAuth implements Authentication {
|
||||
|
||||
final String location;
|
||||
final String paramName;
|
||||
String apiKey;
|
||||
String apiKeyPrefix;
|
||||
|
||||
ApiKeyAuth(this.location, this.paramName);
|
||||
|
||||
@override
|
||||
void applyToParams(List<QueryParam> queryParams, Map<String, String> headerParams) {
|
||||
String value;
|
||||
if (apiKeyPrefix != null) {
|
||||
value = '$apiKeyPrefix $apiKey';
|
||||
} else {
|
||||
value = apiKey;
|
||||
}
|
||||
|
||||
if (location == 'query' && value != null) {
|
||||
queryParams.add(new QueryParam(paramName, value));
|
||||
} else if (location == 'header' && value != null) {
|
||||
headerParams[paramName] = value;
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
part of swagger.api;
|
||||
|
||||
abstract class Authentication {
|
||||
|
||||
/// Apply authentication settings to header and query params.
|
||||
void applyToParams(List<QueryParam> queryParams, Map<String, String> headerParams);
|
||||
}
|
@ -0,0 +1,14 @@
|
||||
part of swagger.api;
|
||||
|
||||
class HttpBasicAuth implements Authentication {
|
||||
|
||||
String username;
|
||||
String password;
|
||||
|
||||
@override
|
||||
void applyToParams(List<QueryParam> queryParams, Map<String, String> headerParams) {
|
||||
String str = (username == null ? "" : username) + ":" + (password == null ? "" : password);
|
||||
headerParams["Authorization"] = "Basic " + BASE64.encode(UTF8.encode(str));
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
part of swagger.api;
|
||||
|
||||
class OAuth implements Authentication {
|
||||
|
||||
@override
|
||||
void applyToParams(List<QueryParam> queryParams, Map<String, String> headerParams) {
|
||||
// TODO: support oauth
|
||||
}
|
||||
}
|
@ -0,0 +1,54 @@
|
||||
part of swagger.api;
|
||||
|
||||
class ApiResponse {
|
||||
|
||||
int code = null;
|
||||
|
||||
|
||||
String type = null;
|
||||
|
||||
|
||||
String message = null;
|
||||
|
||||
ApiResponse();
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'ApiResponse[code=$code, type=$type, message=$message, ]';
|
||||
}
|
||||
|
||||
ApiResponse.fromJson(Map<String, dynamic> json) {
|
||||
if (json == null) return;
|
||||
code =
|
||||
json['code'];
|
||||
type =
|
||||
json['type'];
|
||||
message =
|
||||
json['message'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
return {
|
||||
'code': code,
|
||||
'type': type,
|
||||
'message': message
|
||||
};
|
||||
}
|
||||
|
||||
static List<ApiResponse> listFromJson(List<Map<String, dynamic>> json) {
|
||||
var list = new List<ApiResponse>();
|
||||
if (json != null && json.length > 0) {
|
||||
json.forEach((Map<String, dynamic> value) => list.add(new ApiResponse.fromJson(value)));
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
static Map<String, ApiResponse> mapFromJson(Map<String, Map<String, dynamic>> json) {
|
||||
var map = new Map<String, ApiResponse>();
|
||||
if (json != null && json.length > 0) {
|
||||
json.forEach((String key, Map<String, dynamic> value) => map[key] = new ApiResponse.fromJson(value));
|
||||
}
|
||||
return map;
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,48 @@
|
||||
part of swagger.api;
|
||||
|
||||
class Category {
|
||||
|
||||
int id = null;
|
||||
|
||||
|
||||
String name = null;
|
||||
|
||||
Category();
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'Category[id=$id, name=$name, ]';
|
||||
}
|
||||
|
||||
Category.fromJson(Map<String, dynamic> json) {
|
||||
if (json == null) return;
|
||||
id =
|
||||
json['id'];
|
||||
name =
|
||||
json['name'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
return {
|
||||
'id': id,
|
||||
'name': name
|
||||
};
|
||||
}
|
||||
|
||||
static List<Category> listFromJson(List<Map<String, dynamic>> json) {
|
||||
var list = new List<Category>();
|
||||
if (json != null && json.length > 0) {
|
||||
json.forEach((Map<String, dynamic> value) => list.add(new Category.fromJson(value)));
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
static Map<String, Category> mapFromJson(Map<String, Map<String, dynamic>> json) {
|
||||
var map = new Map<String, Category>();
|
||||
if (json != null && json.length > 0) {
|
||||
json.forEach((String key, Map<String, dynamic> value) => map[key] = new Category.fromJson(value));
|
||||
}
|
||||
return map;
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,71 @@
|
||||
part of swagger.api;
|
||||
|
||||
class Order {
|
||||
|
||||
int id = null;
|
||||
|
||||
|
||||
int petId = null;
|
||||
|
||||
|
||||
int quantity = null;
|
||||
|
||||
|
||||
DateTime shipDate = null;
|
||||
|
||||
/* Order Status */
|
||||
String status = null;
|
||||
//enum statusEnum { placed, approved, delivered, };
|
||||
|
||||
bool complete = null;
|
||||
|
||||
Order();
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'Order[id=$id, petId=$petId, quantity=$quantity, shipDate=$shipDate, status=$status, complete=$complete, ]';
|
||||
}
|
||||
|
||||
Order.fromJson(Map<String, dynamic> json) {
|
||||
if (json == null) return;
|
||||
id =
|
||||
json['id'];
|
||||
petId =
|
||||
json['petId'];
|
||||
quantity =
|
||||
json['quantity'];
|
||||
shipDate = json['shipDate'] == null ? null : DateTime.parse(json['shipDate']);
|
||||
status =
|
||||
json['status'];
|
||||
complete =
|
||||
json['complete'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
return {
|
||||
'id': id,
|
||||
'petId': petId,
|
||||
'quantity': quantity,
|
||||
'shipDate': shipDate == null ? '' : shipDate.toUtc().toIso8601String(),
|
||||
'status': status,
|
||||
'complete': complete
|
||||
};
|
||||
}
|
||||
|
||||
static List<Order> listFromJson(List<Map<String, dynamic>> json) {
|
||||
var list = new List<Order>();
|
||||
if (json != null && json.length > 0) {
|
||||
json.forEach((Map<String, dynamic> value) => list.add(new Order.fromJson(value)));
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
static Map<String, Order> mapFromJson(Map<String, Map<String, dynamic>> json) {
|
||||
var map = new Map<String, Order>();
|
||||
if (json != null && json.length > 0) {
|
||||
json.forEach((String key, Map<String, dynamic> value) => map[key] = new Order.fromJson(value));
|
||||
}
|
||||
return map;
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,76 @@
|
||||
part of swagger.api;
|
||||
|
||||
class Pet {
|
||||
|
||||
int id = null;
|
||||
|
||||
|
||||
Category category = null;
|
||||
|
||||
|
||||
String name = null;
|
||||
|
||||
|
||||
List<String> photoUrls = [];
|
||||
|
||||
|
||||
List<Tag> tags = [];
|
||||
|
||||
/* pet status in the store */
|
||||
String status = null;
|
||||
//enum statusEnum { available, pending, sold, };
|
||||
Pet();
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'Pet[id=$id, category=$category, name=$name, photoUrls=$photoUrls, tags=$tags, status=$status, ]';
|
||||
}
|
||||
|
||||
Pet.fromJson(Map<String, dynamic> json) {
|
||||
if (json == null) return;
|
||||
id =
|
||||
json['id'];
|
||||
category =
|
||||
|
||||
|
||||
new Category.fromJson(json['category'])
|
||||
;
|
||||
name =
|
||||
json['name'];
|
||||
photoUrls =
|
||||
json['photoUrls'];
|
||||
tags =
|
||||
Tag.listFromJson(json['tags'])
|
||||
;
|
||||
status =
|
||||
json['status'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
return {
|
||||
'id': id,
|
||||
'category': category,
|
||||
'name': name,
|
||||
'photoUrls': photoUrls,
|
||||
'tags': tags,
|
||||
'status': status
|
||||
};
|
||||
}
|
||||
|
||||
static List<Pet> listFromJson(List<Map<String, dynamic>> json) {
|
||||
var list = new List<Pet>();
|
||||
if (json != null && json.length > 0) {
|
||||
json.forEach((Map<String, dynamic> value) => list.add(new Pet.fromJson(value)));
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
static Map<String, Pet> mapFromJson(Map<String, Map<String, dynamic>> json) {
|
||||
var map = new Map<String, Pet>();
|
||||
if (json != null && json.length > 0) {
|
||||
json.forEach((String key, Map<String, dynamic> value) => map[key] = new Pet.fromJson(value));
|
||||
}
|
||||
return map;
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,48 @@
|
||||
part of swagger.api;
|
||||
|
||||
class Tag {
|
||||
|
||||
int id = null;
|
||||
|
||||
|
||||
String name = null;
|
||||
|
||||
Tag();
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'Tag[id=$id, name=$name, ]';
|
||||
}
|
||||
|
||||
Tag.fromJson(Map<String, dynamic> json) {
|
||||
if (json == null) return;
|
||||
id =
|
||||
json['id'];
|
||||
name =
|
||||
json['name'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
return {
|
||||
'id': id,
|
||||
'name': name
|
||||
};
|
||||
}
|
||||
|
||||
static List<Tag> listFromJson(List<Map<String, dynamic>> json) {
|
||||
var list = new List<Tag>();
|
||||
if (json != null && json.length > 0) {
|
||||
json.forEach((Map<String, dynamic> value) => list.add(new Tag.fromJson(value)));
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
static Map<String, Tag> mapFromJson(Map<String, Map<String, dynamic>> json) {
|
||||
var map = new Map<String, Tag>();
|
||||
if (json != null && json.length > 0) {
|
||||
json.forEach((String key, Map<String, dynamic> value) => map[key] = new Tag.fromJson(value));
|
||||
}
|
||||
return map;
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,84 @@
|
||||
part of swagger.api;
|
||||
|
||||
class User {
|
||||
|
||||
int id = null;
|
||||
|
||||
|
||||
String username = null;
|
||||
|
||||
|
||||
String firstName = null;
|
||||
|
||||
|
||||
String lastName = null;
|
||||
|
||||
|
||||
String email = null;
|
||||
|
||||
|
||||
String password = null;
|
||||
|
||||
|
||||
String phone = null;
|
||||
|
||||
/* User Status */
|
||||
int userStatus = null;
|
||||
|
||||
User();
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'User[id=$id, username=$username, firstName=$firstName, lastName=$lastName, email=$email, password=$password, phone=$phone, userStatus=$userStatus, ]';
|
||||
}
|
||||
|
||||
User.fromJson(Map<String, dynamic> json) {
|
||||
if (json == null) return;
|
||||
id =
|
||||
json['id'];
|
||||
username =
|
||||
json['username'];
|
||||
firstName =
|
||||
json['firstName'];
|
||||
lastName =
|
||||
json['lastName'];
|
||||
email =
|
||||
json['email'];
|
||||
password =
|
||||
json['password'];
|
||||
phone =
|
||||
json['phone'];
|
||||
userStatus =
|
||||
json['userStatus'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
return {
|
||||
'id': id,
|
||||
'username': username,
|
||||
'firstName': firstName,
|
||||
'lastName': lastName,
|
||||
'email': email,
|
||||
'password': password,
|
||||
'phone': phone,
|
||||
'userStatus': userStatus
|
||||
};
|
||||
}
|
||||
|
||||
static List<User> listFromJson(List<Map<String, dynamic>> json) {
|
||||
var list = new List<User>();
|
||||
if (json != null && json.length > 0) {
|
||||
json.forEach((Map<String, dynamic> value) => list.add(new User.fromJson(value)));
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
static Map<String, User> mapFromJson(Map<String, Map<String, dynamic>> json) {
|
||||
var map = new Map<String, User>();
|
||||
if (json != null && json.length > 0) {
|
||||
json.forEach((String key, Map<String, dynamic> value) => map[key] = new User.fromJson(value));
|
||||
}
|
||||
return map;
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,5 @@
|
||||
name: swagger
|
||||
version: 1.0.0
|
||||
description: Swagger API client
|
||||
dependencies:
|
||||
http: '>=0.11.1 <0.12.0'
|
@ -0,0 +1,29 @@
|
||||
// This is a basic Flutter widget test.
|
||||
// To perform an interaction with a widget in your test, use the WidgetTester utility that Flutter
|
||||
// provides. For example, you can send tap and scroll gestures. You can also use WidgetTester to
|
||||
// find child widgets in the widget tree, read text, and verify that the values of widget properties
|
||||
// are correct.
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
import 'package:flutter_petstore/main.dart';
|
||||
|
||||
void main() {
|
||||
testWidgets('Counter increments smoke test', (WidgetTester tester) async {
|
||||
// Build our app and trigger a frame.
|
||||
await tester.pumpWidget(new MyApp());
|
||||
|
||||
// Verify that our counter starts at 0.
|
||||
expect(find.text('0'), findsOneWidget);
|
||||
expect(find.text('1'), findsNothing);
|
||||
|
||||
// Tap the '+' icon and trigger a frame.
|
||||
await tester.tap(find.byIcon(Icons.add));
|
||||
await tester.pump();
|
||||
|
||||
// Verify that our counter has incremented.
|
||||
expect(find.text('0'), findsNothing);
|
||||
expect(find.text('1'), findsOneWidget);
|
||||
});
|
||||
}
|