Fix content-type and accept in PHP API

This commit is contained in:
William Cheng 2015-04-01 04:26:32 +08:00
parent 6ac497d774
commit 03c48af9e6
9 changed files with 397 additions and 42 deletions

View File

@ -44,8 +44,12 @@ class {{classname}} {
$queryParams = array();
$headerParams = array();
$formParams = array();
$headerParams['Accept'] = '{{#produces}}{{mediaType}}{{#hasMore}},{{/hasMore}}{{/produces}}';
$headerParams['Content-Type'] = '{{#consumes}}{{mediaType}}{{#hasMore}},{{/hasMore}}{{/consumes}}';
$_header_accept = '{{#produces}}{{mediaType}}{{#hasMore}}, {{/hasMore}}{{/produces}}';
if ($_header_accept !== '') {
$headerParams['Accept'] = $_header_accept;
}
$_header_content_type = array({{#consumes}}'{{mediaType}}'{{#hasMore}},{{/hasMore}}{{/consumes}});
$headerParams['Content-Type'] = count($_header_content_type) > 0 ? $_header_content_type[0] : 'application/json';
{{#queryParams}}// query params
if(${{paramName}} !== null) {

View File

@ -0,0 +1,34 @@
using System;
using System.Text;
using System.Collections;
using System.Collections.Generic;
namespace io.swagger.Model {
public class category {
public long? id { get; set; }
public string name { get; set; }
public override string ToString() {
var sb = new StringBuilder();
sb.Append("class category {\n");
sb.Append(" id: ").Append(id).Append("\n");
sb.Append(" name: ").Append(name).Append("\n");
sb.Append("}\n");
return sb.ToString();
}
}
}

View File

@ -0,0 +1,63 @@
using System;
using System.Text;
using System.Collections;
using System.Collections.Generic;
namespace io.swagger.Model {
public class order {
public long? id { get; set; }
public long? petId { get; set; }
public int? quantity { get; set; }
public DateTime shipDate { get; set; }
/* Order Status */
public string status { get; set; }
public bool? complete { get; set; }
public override string ToString() {
var sb = new StringBuilder();
sb.Append("class order {\n");
sb.Append(" id: ").Append(id).Append("\n");
sb.Append(" petId: ").Append(petId).Append("\n");
sb.Append(" quantity: ").Append(quantity).Append("\n");
sb.Append(" shipDate: ").Append(shipDate).Append("\n");
sb.Append(" status: ").Append(status).Append("\n");
sb.Append(" complete: ").Append(complete).Append("\n");
sb.Append("}\n");
return sb.ToString();
}
}
}

View File

@ -0,0 +1,63 @@
using System;
using System.Text;
using System.Collections;
using System.Collections.Generic;
namespace io.swagger.Model {
public class pet {
public long? id { get; set; }
public Category category { get; set; }
public string name { get; set; }
public List<string> photoUrls { get; set; }
public List<Tag> tags { get; set; }
/* pet status in the store */
public string status { get; set; }
public override string ToString() {
var sb = new StringBuilder();
sb.Append("class pet {\n");
sb.Append(" id: ").Append(id).Append("\n");
sb.Append(" category: ").Append(category).Append("\n");
sb.Append(" name: ").Append(name).Append("\n");
sb.Append(" photoUrls: ").Append(photoUrls).Append("\n");
sb.Append(" tags: ").Append(tags).Append("\n");
sb.Append(" status: ").Append(status).Append("\n");
sb.Append("}\n");
return sb.ToString();
}
}
}

View File

@ -0,0 +1,34 @@
using System;
using System.Text;
using System.Collections;
using System.Collections.Generic;
namespace io.swagger.Model {
public class tag {
public long? id { get; set; }
public string name { get; set; }
public override string ToString() {
var sb = new StringBuilder();
sb.Append("class tag {\n");
sb.Append(" id: ").Append(id).Append("\n");
sb.Append(" name: ").Append(name).Append("\n");
sb.Append("}\n");
return sb.ToString();
}
}
}

View File

@ -0,0 +1,77 @@
using System;
using System.Text;
using System.Collections;
using System.Collections.Generic;
namespace io.swagger.Model {
public class user {
public long? id { get; set; }
public string username { get; set; }
public string firstName { get; set; }
public string lastName { get; set; }
public string email { get; set; }
public string password { get; set; }
public string phone { get; set; }
/* User Status */
public int? userStatus { get; set; }
public override string ToString() {
var sb = new StringBuilder();
sb.Append("class user {\n");
sb.Append(" id: ").Append(id).Append("\n");
sb.Append(" username: ").Append(username).Append("\n");
sb.Append(" firstName: ").Append(firstName).Append("\n");
sb.Append(" lastName: ").Append(lastName).Append("\n");
sb.Append(" email: ").Append(email).Append("\n");
sb.Append(" password: ").Append(password).Append("\n");
sb.Append(" phone: ").Append(phone).Append("\n");
sb.Append(" userStatus: ").Append(userStatus).Append("\n");
sb.Append("}\n");
return sb.ToString();
}
}
}

View File

@ -43,8 +43,12 @@ class PetApi {
$queryParams = array();
$headerParams = array();
$formParams = array();
$headerParams['Accept'] = 'application/json,application/xml';
$headerParams['Content-Type'] = 'application/json,application/xml';
$_header_accept = 'application/json, application/xml';
if ($_header_accept !== '') {
$headerParams['Accept'] = $_header_accept;
}
$_header_content_type = array('application/json','application/xml');
$headerParams['Content-Type'] = count($_header_content_type) > 0 ? $_header_content_type[0] : 'application/json';
@ -88,8 +92,12 @@ class PetApi {
$queryParams = array();
$headerParams = array();
$formParams = array();
$headerParams['Accept'] = 'application/json,application/xml';
$headerParams['Content-Type'] = 'application/json,application/xml';
$_header_accept = 'application/json, application/xml';
if ($_header_accept !== '') {
$headerParams['Accept'] = $_header_accept;
}
$_header_content_type = array('application/json','application/xml');
$headerParams['Content-Type'] = count($_header_content_type) > 0 ? $_header_content_type[0] : 'application/json';
@ -133,8 +141,12 @@ class PetApi {
$queryParams = array();
$headerParams = array();
$formParams = array();
$headerParams['Accept'] = 'application/json,application/xml';
$headerParams['Content-Type'] = '';
$_header_accept = 'application/json, application/xml';
if ($_header_accept !== '') {
$headerParams['Accept'] = $_header_accept;
}
$_header_content_type = array();
$headerParams['Content-Type'] = count($_header_content_type) > 0 ? $_header_content_type[0] : 'application/json';
// query params
if($status !== null) {
@ -183,8 +195,12 @@ class PetApi {
$queryParams = array();
$headerParams = array();
$formParams = array();
$headerParams['Accept'] = 'application/json,application/xml';
$headerParams['Content-Type'] = '';
$_header_accept = 'application/json, application/xml';
if ($_header_accept !== '') {
$headerParams['Accept'] = $_header_accept;
}
$_header_content_type = array();
$headerParams['Content-Type'] = count($_header_content_type) > 0 ? $_header_content_type[0] : 'application/json';
// query params
if($tags !== null) {
@ -233,8 +249,12 @@ class PetApi {
$queryParams = array();
$headerParams = array();
$formParams = array();
$headerParams['Accept'] = 'application/json,application/xml';
$headerParams['Content-Type'] = '';
$_header_accept = 'application/json, application/xml';
if ($_header_accept !== '') {
$headerParams['Accept'] = $_header_accept;
}
$_header_content_type = array();
$headerParams['Content-Type'] = count($_header_content_type) > 0 ? $_header_content_type[0] : 'application/json';
@ -286,8 +306,12 @@ class PetApi {
$queryParams = array();
$headerParams = array();
$formParams = array();
$headerParams['Accept'] = 'application/json,application/xml';
$headerParams['Content-Type'] = 'application/x-www-form-urlencoded';
$_header_accept = 'application/json, application/xml';
if ($_header_accept !== '') {
$headerParams['Accept'] = $_header_accept;
}
$_header_content_type = array('application/x-www-form-urlencoded');
$headerParams['Content-Type'] = count($_header_content_type) > 0 ? $_header_content_type[0] : 'application/json';
@ -338,8 +362,12 @@ class PetApi {
$queryParams = array();
$headerParams = array();
$formParams = array();
$headerParams['Accept'] = 'application/json,application/xml';
$headerParams['Content-Type'] = '';
$_header_accept = 'application/json, application/xml';
if ($_header_accept !== '') {
$headerParams['Accept'] = $_header_accept;
}
$_header_content_type = array();
$headerParams['Content-Type'] = count($_header_content_type) > 0 ? $_header_content_type[0] : 'application/json';
// header params
@ -388,8 +416,12 @@ class PetApi {
$queryParams = array();
$headerParams = array();
$formParams = array();
$headerParams['Accept'] = 'application/json,application/xml';
$headerParams['Content-Type'] = 'multipart/form-data';
$_header_accept = 'application/json, application/xml';
if ($_header_accept !== '') {
$headerParams['Accept'] = $_header_accept;
}
$_header_content_type = array('multipart/form-data');
$headerParams['Content-Type'] = count($_header_content_type) > 0 ? $_header_content_type[0] : 'application/json';

View File

@ -42,8 +42,12 @@ class StoreApi {
$queryParams = array();
$headerParams = array();
$formParams = array();
$headerParams['Accept'] = 'application/json,application/xml';
$headerParams['Content-Type'] = '';
$_header_accept = 'application/json, application/xml';
if ($_header_accept !== '') {
$headerParams['Accept'] = $_header_accept;
}
$_header_content_type = array();
$headerParams['Content-Type'] = count($_header_content_type) > 0 ? $_header_content_type[0] : 'application/json';
@ -89,8 +93,12 @@ class StoreApi {
$queryParams = array();
$headerParams = array();
$formParams = array();
$headerParams['Accept'] = 'application/json,application/xml';
$headerParams['Content-Type'] = '';
$_header_accept = 'application/json, application/xml';
if ($_header_accept !== '') {
$headerParams['Accept'] = $_header_accept;
}
$_header_content_type = array();
$headerParams['Content-Type'] = count($_header_content_type) > 0 ? $_header_content_type[0] : 'application/json';
@ -140,8 +148,12 @@ class StoreApi {
$queryParams = array();
$headerParams = array();
$formParams = array();
$headerParams['Accept'] = 'application/json,application/xml';
$headerParams['Content-Type'] = '';
$_header_accept = 'application/json, application/xml';
if ($_header_accept !== '') {
$headerParams['Accept'] = $_header_accept;
}
$_header_content_type = array();
$headerParams['Content-Type'] = count($_header_content_type) > 0 ? $_header_content_type[0] : 'application/json';
@ -191,8 +203,12 @@ class StoreApi {
$queryParams = array();
$headerParams = array();
$formParams = array();
$headerParams['Accept'] = 'application/json,application/xml';
$headerParams['Content-Type'] = '';
$_header_accept = 'application/json, application/xml';
if ($_header_accept !== '') {
$headerParams['Accept'] = $_header_accept;
}
$_header_content_type = array();
$headerParams['Content-Type'] = count($_header_content_type) > 0 ? $_header_content_type[0] : 'application/json';

View File

@ -43,8 +43,12 @@ class UserApi {
$queryParams = array();
$headerParams = array();
$formParams = array();
$headerParams['Accept'] = 'application/json,application/xml';
$headerParams['Content-Type'] = '';
$_header_accept = 'application/json, application/xml';
if ($_header_accept !== '') {
$headerParams['Accept'] = $_header_accept;
}
$_header_content_type = array();
$headerParams['Content-Type'] = count($_header_content_type) > 0 ? $_header_content_type[0] : 'application/json';
@ -88,8 +92,12 @@ class UserApi {
$queryParams = array();
$headerParams = array();
$formParams = array();
$headerParams['Accept'] = 'application/json,application/xml';
$headerParams['Content-Type'] = '';
$_header_accept = 'application/json, application/xml';
if ($_header_accept !== '') {
$headerParams['Accept'] = $_header_accept;
}
$_header_content_type = array();
$headerParams['Content-Type'] = count($_header_content_type) > 0 ? $_header_content_type[0] : 'application/json';
@ -133,8 +141,12 @@ class UserApi {
$queryParams = array();
$headerParams = array();
$formParams = array();
$headerParams['Accept'] = 'application/json,application/xml';
$headerParams['Content-Type'] = '';
$_header_accept = 'application/json, application/xml';
if ($_header_accept !== '') {
$headerParams['Accept'] = $_header_accept;
}
$_header_content_type = array();
$headerParams['Content-Type'] = count($_header_content_type) > 0 ? $_header_content_type[0] : 'application/json';
@ -179,8 +191,12 @@ class UserApi {
$queryParams = array();
$headerParams = array();
$formParams = array();
$headerParams['Accept'] = 'application/json,application/xml';
$headerParams['Content-Type'] = '';
$_header_accept = 'application/json, application/xml';
if ($_header_accept !== '') {
$headerParams['Accept'] = $_header_accept;
}
$_header_content_type = array();
$headerParams['Content-Type'] = count($_header_content_type) > 0 ? $_header_content_type[0] : 'application/json';
// query params
if($username !== null) {
@ -231,8 +247,12 @@ class UserApi {
$queryParams = array();
$headerParams = array();
$formParams = array();
$headerParams['Accept'] = 'application/json,application/xml';
$headerParams['Content-Type'] = '';
$_header_accept = 'application/json, application/xml';
if ($_header_accept !== '') {
$headerParams['Accept'] = $_header_accept;
}
$_header_content_type = array();
$headerParams['Content-Type'] = count($_header_content_type) > 0 ? $_header_content_type[0] : 'application/json';
@ -272,8 +292,12 @@ class UserApi {
$queryParams = array();
$headerParams = array();
$formParams = array();
$headerParams['Accept'] = 'application/json,application/xml';
$headerParams['Content-Type'] = '';
$_header_accept = 'application/json, application/xml';
if ($_header_accept !== '') {
$headerParams['Accept'] = $_header_accept;
}
$_header_content_type = array();
$headerParams['Content-Type'] = count($_header_content_type) > 0 ? $_header_content_type[0] : 'application/json';
@ -324,8 +348,12 @@ class UserApi {
$queryParams = array();
$headerParams = array();
$formParams = array();
$headerParams['Accept'] = 'application/json,application/xml';
$headerParams['Content-Type'] = '';
$_header_accept = 'application/json, application/xml';
if ($_header_accept !== '') {
$headerParams['Accept'] = $_header_accept;
}
$_header_content_type = array();
$headerParams['Content-Type'] = count($_header_content_type) > 0 ? $_header_content_type[0] : 'application/json';
@ -373,8 +401,12 @@ class UserApi {
$queryParams = array();
$headerParams = array();
$formParams = array();
$headerParams['Accept'] = 'application/json,application/xml';
$headerParams['Content-Type'] = '';
$_header_accept = 'application/json, application/xml';
if ($_header_accept !== '') {
$headerParams['Accept'] = $_header_accept;
}
$_header_content_type = array();
$headerParams['Content-Type'] = count($_header_content_type) > 0 ? $_header_content_type[0] : 'application/json';