SlideShare ist ein Scribd-Unternehmen logo
1 von 45
Downloaden Sie, um offline zu lesen
Oregon
São Paulo
Frankfurt
{JSON}
Swagger
Swagger
๑⁼̴̀ ⁼̴́๑ ‼
https://www.openapis.org/membership/members
/statuses/show/{id}:
get:
description: Retruns a single Tweet
security:
- oauth:
- basic
parameters:
- name: id
in: path
description: The numerical ID of the desired status
required: true
type: string
- name: trim_user
in: query
description: When set to either true, t or 1, each tweet
required: false
type: string
- name: include_my_retweet
in: query
$ wget http://central.maven.org/
maven2/io/swagger/swagger-codegen-cli/
2.2.2/swagger-codegen-cli-2.2.2.jar
$ brew install swagger-codegen
!
$ swagger-codegen generate
-i swaggerspec.json
-l CsharpDotNet2
-o src
-c config.json
{
"packageName": "Connect.Navi.Client"
}
namespace IO.Swagger.Model {
[DataContract]
public class User {
[DataMember(Name="id", EmitDefaultValue=false)]
[JsonProperty(PropertyName = "id")]
public long? Id { get; set; }
[DataMember(Name="username", EmitDefaultValue=false)]
[JsonProperty(PropertyName = "username")]
public string Username { get; set; }
[DataMember(Name="firstName", EmitDefaultValue=false)]
[JsonProperty(PropertyName = "firstName")]
public string FirstName { get; set; }
[DataMember(Name="lastName", EmitDefaultValue=false)]
[JsonProperty(PropertyName = "lastName")]
public string LastName { get; set; }
/// <summary>
/// Gets or Sets Email
namespace IO.Swagger.Api
{
public interface IUserApi
{
void CreateUser (User body);
void CreateUsersWithArrayInput (List<User> body);
void CreateUsersWithListInput (List<User> body);
void DeleteUser (string username);
User GetUserByName (string username);
string LoginUser (string username, string password);
void LogoutUser ();
void UpdateUser (string username, User body);
}
public class UserApi : IUserApi
{
//
/// <param name="apiClient"> an instance of ApiClient (optional)</
param>
/// <returns></returns>
namespace IO.Swagger.Client
{
public class ApiClient
{
private readonly Dictionary<String, String> _defaultHeaderMap
= new Dictionary<String, String>();
public ApiClient(String basePath=“http://localhost:8080")
{
BasePath = basePath;
RestClient = new RestClient(BasePath);
}
/// <summary>
/// Makes the HTTP request (Sync).
/// </summary>
/// <param name="path">URL path.</param>
/// <param name="method">HTTP method.</param>
/// <param name="queryParams">Query parameters.</param>
/// <param name="postBody">HTTP body (POST request).</param>
/// <param name="headerParams">Header parameters.</param>
/// <param name="formParams">Form parameters.</param>
public Object CallApi(String path, RestSharp.Method method,
Dictionary<String, String> queryParams, String postBody,
Dictionary<String, String> headerParams, Dictionary<String, String> formParams,
Dictionary<String, FileParameter> fileParams, String[] authSettings)
{
var request = new RestRequest(path, method);
UpdateParamsForAuth(queryParams, headerParams, authSettings);
// add default header, if any
foreach(var defaultHeader in _defaultHeaderMap)
request.AddHeader(defaultHeader.Key, defaultHeader.Value);
// add header parameter, if any
foreach(var param in headerParams)
request.AddHeader(param.Key, param.Value);
// add query parameter, if any
foreach(var param in queryParams)
request.AddParameter(param.Key, param.Value, ParameterType.GetOrPost);
// add form parameter, if any
foreach(var param in formParams)
request.AddParameter(param.Key, param.Value, ParameterType.GetOrPost);
// add file parameter, if any
foreach(var param in fileParams)
request.AddFile(param.Value.Name, param.Value.Writer, param.Value.FileName,
aram.Value.ContentType);
XamarinとAWSをつないでみた話
XamarinとAWSをつないでみた話
XamarinとAWSをつないでみた話
XamarinとAWSをつないでみた話

Weitere ähnliche Inhalte

Was ist angesagt?

Cake fest 2012 create a restful api
Cake fest 2012 create a restful apiCake fest 2012 create a restful api
Cake fest 2012 create a restful api
ceeram
 

Was ist angesagt? (20)

Rest api with Python
Rest api with PythonRest api with Python
Rest api with Python
 
23.simple login with sessions in laravel 5
23.simple login with sessions in laravel 523.simple login with sessions in laravel 5
23.simple login with sessions in laravel 5
 
Designing CakePHP plugins for consuming APIs
Designing CakePHP plugins for consuming APIsDesigning CakePHP plugins for consuming APIs
Designing CakePHP plugins for consuming APIs
 
Binary Studio Academy 2016: Laravel Controllers
Binary Studio Academy 2016: Laravel ControllersBinary Studio Academy 2016: Laravel Controllers
Binary Studio Academy 2016: Laravel Controllers
 
Using the new WordPress REST API
Using the new WordPress REST APIUsing the new WordPress REST API
Using the new WordPress REST API
 
RESTful Web Development with CakePHP
RESTful Web Development with CakePHPRESTful Web Development with CakePHP
RESTful Web Development with CakePHP
 
Connecting Content Silos: One CMS, Many Sites With The WordPress REST API
 Connecting Content Silos: One CMS, Many Sites With The WordPress REST API Connecting Content Silos: One CMS, Many Sites With The WordPress REST API
Connecting Content Silos: One CMS, Many Sites With The WordPress REST API
 
Bootstrat REST APIs with Laravel 5
Bootstrat REST APIs with Laravel 5Bootstrat REST APIs with Laravel 5
Bootstrat REST APIs with Laravel 5
 
Flask - Backend com Python - Semcomp 18
Flask - Backend com Python - Semcomp 18Flask - Backend com Python - Semcomp 18
Flask - Backend com Python - Semcomp 18
 
Kyiv.py #17 Flask talk
Kyiv.py #17 Flask talkKyiv.py #17 Flask talk
Kyiv.py #17 Flask talk
 
21.search in laravel
21.search in laravel21.search in laravel
21.search in laravel
 
REST APIs in Laravel 101
REST APIs in Laravel 101REST APIs in Laravel 101
REST APIs in Laravel 101
 
Codeigniter4の比較と検証
Codeigniter4の比較と検証Codeigniter4の比較と検証
Codeigniter4の比較と検証
 
Filling the flask
Filling the flaskFilling the flask
Filling the flask
 
Cake fest 2012 create a restful api
Cake fest 2012 create a restful apiCake fest 2012 create a restful api
Cake fest 2012 create a restful api
 
Desenvolvendo APIs usando Rails - Guru SC 2012
Desenvolvendo APIs usando Rails - Guru SC 2012Desenvolvendo APIs usando Rails - Guru SC 2012
Desenvolvendo APIs usando Rails - Guru SC 2012
 
エロサイト管理者の憂鬱3 - Hokkaiodo.pm#4 -
エロサイト管理者の憂鬱3 - Hokkaiodo.pm#4 -エロサイト管理者の憂鬱3 - Hokkaiodo.pm#4 -
エロサイト管理者の憂鬱3 - Hokkaiodo.pm#4 -
 
Apache cheat sheet
Apache cheat sheetApache cheat sheet
Apache cheat sheet
 
Webrtc mojo
Webrtc mojoWebrtc mojo
Webrtc mojo
 
Zend framework
Zend frameworkZend framework
Zend framework
 

Ähnlich wie XamarinとAWSをつないでみた話

Building @Anywhere (for TXJS)
Building @Anywhere (for TXJS)Building @Anywhere (for TXJS)
Building @Anywhere (for TXJS)
danwrong
 
03 form-data
03 form-data03 form-data
03 form-data
snopteck
 
If love is_blind_-_tiffany
If love is_blind_-_tiffanyIf love is_blind_-_tiffany
If love is_blind_-_tiffany
tenka
 

Ähnlich wie XamarinとAWSをつないでみた話 (20)

Bonnes pratiques de développement avec Node js
Bonnes pratiques de développement avec Node jsBonnes pratiques de développement avec Node js
Bonnes pratiques de développement avec Node js
 
Using and scaling Rack and Rack-based middleware
Using and scaling Rack and Rack-based middlewareUsing and scaling Rack and Rack-based middleware
Using and scaling Rack and Rack-based middleware
 
Rich Portlet Development in uPortal
Rich Portlet Development in uPortalRich Portlet Development in uPortal
Rich Portlet Development in uPortal
 
Overview of RESTful web services
Overview of RESTful web servicesOverview of RESTful web services
Overview of RESTful web services
 
Building @Anywhere (for TXJS)
Building @Anywhere (for TXJS)Building @Anywhere (for TXJS)
Building @Anywhere (for TXJS)
 
Spring MVC 3 Restful
Spring MVC 3 RestfulSpring MVC 3 Restful
Spring MVC 3 Restful
 
Spring MVC Annotations
Spring MVC AnnotationsSpring MVC Annotations
Spring MVC Annotations
 
03 form-data
03 form-data03 form-data
03 form-data
 
Xitrum Web Framework Live Coding Demos / Xitrum Web Framework ライブコーディング
Xitrum Web Framework Live Coding Demos / Xitrum Web Framework ライブコーディングXitrum Web Framework Live Coding Demos / Xitrum Web Framework ライブコーディング
Xitrum Web Framework Live Coding Demos / Xitrum Web Framework ライブコーディング
 
Xitrum @ Scala Matsuri Tokyo 2014
Xitrum @ Scala Matsuri Tokyo 2014Xitrum @ Scala Matsuri Tokyo 2014
Xitrum @ Scala Matsuri Tokyo 2014
 
Mashing up JavaScript
Mashing up JavaScriptMashing up JavaScript
Mashing up JavaScript
 
Great Developers Steal
Great Developers StealGreat Developers Steal
Great Developers Steal
 
jSession #4 - Maciej Puchalski - Zaawansowany retrofit
jSession #4 - Maciej Puchalski - Zaawansowany retrofitjSession #4 - Maciej Puchalski - Zaawansowany retrofit
jSession #4 - Maciej Puchalski - Zaawansowany retrofit
 
YDN KR Tech Talk : Pipes 와 YQL 활용하기
YDN KR Tech Talk : Pipes 와 YQL 활용하기YDN KR Tech Talk : Pipes 와 YQL 활용하기
YDN KR Tech Talk : Pipes 와 YQL 활용하기
 
Mashing up JavaScript – Advanced Techniques for modern Web Apps
Mashing up JavaScript – Advanced Techniques for modern Web AppsMashing up JavaScript – Advanced Techniques for modern Web Apps
Mashing up JavaScript – Advanced Techniques for modern Web Apps
 
If love is_blind_-_tiffany
If love is_blind_-_tiffanyIf love is_blind_-_tiffany
If love is_blind_-_tiffany
 
May 2010 - RestEasy
May 2010 - RestEasyMay 2010 - RestEasy
May 2010 - RestEasy
 
Rapid java backend and api development for mobile devices
Rapid java backend and api development for mobile devicesRapid java backend and api development for mobile devices
Rapid java backend and api development for mobile devices
 
Twitter codeigniter library
Twitter codeigniter libraryTwitter codeigniter library
Twitter codeigniter library
 
Denys Serhiienko "ASGI in depth"
Denys Serhiienko "ASGI in depth"Denys Serhiienko "ASGI in depth"
Denys Serhiienko "ASGI in depth"
 

Mehr von Takehito Tanabe

第8回クラウドごった煮 4年と半年、AWSを使い続けた結果
第8回クラウドごった煮 4年と半年、AWSを使い続けた結果第8回クラウドごった煮 4年と半年、AWSを使い続けた結果
第8回クラウドごった煮 4年と半年、AWSを使い続けた結果
Takehito Tanabe
 
テレワークHOKKAIDOセミナー 会社を辞めないUターン
テレワークHOKKAIDOセミナー 会社を辞めないUターンテレワークHOKKAIDOセミナー 会社を辞めないUターン
テレワークHOKKAIDOセミナー 会社を辞めないUターン
Takehito Tanabe
 

Mehr von Takehito Tanabe (20)

スタートアップがグローバルなシステムを作るために、積極的にサーバーレスに取り組んでみた話 / Serverless Meetup Sapporo
スタートアップがグローバルなシステムを作るために、積極的にサーバーレスに取り組んでみた話 / Serverless Meetup Sapporoスタートアップがグローバルなシステムを作るために、積極的にサーバーレスに取り組んでみた話 / Serverless Meetup Sapporo
スタートアップがグローバルなシステムを作るために、積極的にサーバーレスに取り組んでみた話 / Serverless Meetup Sapporo
 
エフスタ!!HOKKAIDO エンジニアが この先 生き残るには
エフスタ!!HOKKAIDO エンジニアが この先 生き残るにはエフスタ!!HOKKAIDO エンジニアが この先 生き残るには
エフスタ!!HOKKAIDO エンジニアが この先 生き残るには
 
クラウドで管理する手作り育苗ハウスのつくり方
クラウドで管理する手作り育苗ハウスのつくり方クラウドで管理する手作り育苗ハウスのつくり方
クラウドで管理する手作り育苗ハウスのつくり方
 
さっぽろ農学校成果発表
さっぽろ農学校成果発表さっぽろ農学校成果発表
さっぽろ農学校成果発表
 
JAWS-DAYS 2015 / 北海道 x 農業 x クラウド
JAWS-DAYS 2015 / 北海道 x 農業 x クラウドJAWS-DAYS 2015 / 北海道 x 農業 x クラウド
JAWS-DAYS 2015 / 北海道 x 農業 x クラウド
 
青森ITビジネス・マッチング交流会
青森ITビジネス・マッチング交流会青森ITビジネス・マッチング交流会
青森ITビジネス・マッチング交流会
 
Farmnoteの技術(AWS Cloud Roadshow 2014 札幌)
Farmnoteの技術(AWS Cloud Roadshow 2014 札幌)Farmnoteの技術(AWS Cloud Roadshow 2014 札幌)
Farmnoteの技術(AWS Cloud Roadshow 2014 札幌)
 
リモート勤務でエンジニアをやっているワケ 〜 AWS ジャパンツアー 2014年 夏 札幌
リモート勤務でエンジニアをやっているワケ 〜 AWS ジャパンツアー 2014年 夏 札幌リモート勤務でエンジニアをやっているワケ 〜 AWS ジャパンツアー 2014年 夏 札幌
リモート勤務でエンジニアをやっているワケ 〜 AWS ジャパンツアー 2014年 夏 札幌
 
ブログ製本サービス MyBooks.jpのアーキテクチャ Part.3 AWS Elastic Beanstalkについて
ブログ製本サービス MyBooks.jpのアーキテクチャ Part.3 AWS Elastic Beanstalkについてブログ製本サービス MyBooks.jpのアーキテクチャ Part.3 AWS Elastic Beanstalkについて
ブログ製本サービス MyBooks.jpのアーキテクチャ Part.3 AWS Elastic Beanstalkについて
 
ブログ製本サービス MyBooks.jpのアーキテクチャ Part.2(Amazon Simple Workflow Service編)
ブログ製本サービス MyBooks.jpのアーキテクチャ Part.2(Amazon Simple Workflow Service編)ブログ製本サービス MyBooks.jpのアーキテクチャ Part.2(Amazon Simple Workflow Service編)
ブログ製本サービス MyBooks.jpのアーキテクチャ Part.2(Amazon Simple Workflow Service編)
 
Garage labsサーバー部11U final
Garage labsサーバー部11U finalGarage labsサーバー部11U final
Garage labsサーバー部11U final
 
北海道の楽しい100人
北海道の楽しい100人北海道の楽しい100人
北海道の楽しい100人
 
第8回クラウドごった煮 4年と半年、AWSを使い続けた結果
第8回クラウドごった煮 4年と半年、AWSを使い続けた結果第8回クラウドごった煮 4年と半年、AWSを使い続けた結果
第8回クラウドごった煮 4年と半年、AWSを使い続けた結果
 
ブログ製本サービス MyBooks.jpのアーキテクチャ Part.1
ブログ製本サービス MyBooks.jpのアーキテクチャ Part.1ブログ製本サービス MyBooks.jpのアーキテクチャ Part.1
ブログ製本サービス MyBooks.jpのアーキテクチャ Part.1
 
クラウド移住で地方に住むということ
クラウド移住で地方に住むということクラウド移住で地方に住むということ
クラウド移住で地方に住むということ
 
華麗なるElastic Beanstalkでの環境構築
華麗なるElastic Beanstalkでの環境構築華麗なるElastic Beanstalkでの環境構築
華麗なるElastic Beanstalkでの環境構築
 
テレワークHOKKAIDOセミナー 会社を辞めないUターン
テレワークHOKKAIDOセミナー 会社を辞めないUターンテレワークHOKKAIDOセミナー 会社を辞めないUターン
テレワークHOKKAIDOセミナー 会社を辞めないUターン
 
AWSと1500日
AWSと1500日AWSと1500日
AWSと1500日
 
雲にのって札幌まで来た話
雲にのって札幌まで来た話雲にのって札幌まで来た話
雲にのって札幌まで来た話
 
クラウド移住体験記
クラウド移住体験記クラウド移住体験記
クラウド移住体験記
 

Kürzlich hochgeladen

Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
WSO2
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Victor Rentea
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Victor Rentea
 

Kürzlich hochgeladen (20)

Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 

XamarinとAWSをつないでみた話

  • 1.
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.
  • 11.
  • 12.
  • 13.
  • 15.
  • 16.
  • 17.
  • 21.
  • 23.
  • 24.
  • 25.
  • 26.
  • 27. /statuses/show/{id}: get: description: Retruns a single Tweet security: - oauth: - basic parameters: - name: id in: path description: The numerical ID of the desired status required: true type: string - name: trim_user in: query description: When set to either true, t or 1, each tweet required: false type: string - name: include_my_retweet in: query
  • 28.
  • 29.
  • 30.
  • 31.
  • 32.
  • 33.
  • 34.
  • 35.
  • 37. $ swagger-codegen generate -i swaggerspec.json -l CsharpDotNet2 -o src -c config.json { "packageName": "Connect.Navi.Client" }
  • 38. namespace IO.Swagger.Model { [DataContract] public class User { [DataMember(Name="id", EmitDefaultValue=false)] [JsonProperty(PropertyName = "id")] public long? Id { get; set; } [DataMember(Name="username", EmitDefaultValue=false)] [JsonProperty(PropertyName = "username")] public string Username { get; set; } [DataMember(Name="firstName", EmitDefaultValue=false)] [JsonProperty(PropertyName = "firstName")] public string FirstName { get; set; } [DataMember(Name="lastName", EmitDefaultValue=false)] [JsonProperty(PropertyName = "lastName")] public string LastName { get; set; } /// <summary> /// Gets or Sets Email
  • 39. namespace IO.Swagger.Api { public interface IUserApi { void CreateUser (User body); void CreateUsersWithArrayInput (List<User> body); void CreateUsersWithListInput (List<User> body); void DeleteUser (string username); User GetUserByName (string username); string LoginUser (string username, string password); void LogoutUser (); void UpdateUser (string username, User body); } public class UserApi : IUserApi { // /// <param name="apiClient"> an instance of ApiClient (optional)</ param> /// <returns></returns>
  • 40. namespace IO.Swagger.Client { public class ApiClient { private readonly Dictionary<String, String> _defaultHeaderMap = new Dictionary<String, String>(); public ApiClient(String basePath=“http://localhost:8080") { BasePath = basePath; RestClient = new RestClient(BasePath); } /// <summary> /// Makes the HTTP request (Sync). /// </summary> /// <param name="path">URL path.</param> /// <param name="method">HTTP method.</param> /// <param name="queryParams">Query parameters.</param> /// <param name="postBody">HTTP body (POST request).</param> /// <param name="headerParams">Header parameters.</param> /// <param name="formParams">Form parameters.</param>
  • 41. public Object CallApi(String path, RestSharp.Method method, Dictionary<String, String> queryParams, String postBody, Dictionary<String, String> headerParams, Dictionary<String, String> formParams, Dictionary<String, FileParameter> fileParams, String[] authSettings) { var request = new RestRequest(path, method); UpdateParamsForAuth(queryParams, headerParams, authSettings); // add default header, if any foreach(var defaultHeader in _defaultHeaderMap) request.AddHeader(defaultHeader.Key, defaultHeader.Value); // add header parameter, if any foreach(var param in headerParams) request.AddHeader(param.Key, param.Value); // add query parameter, if any foreach(var param in queryParams) request.AddParameter(param.Key, param.Value, ParameterType.GetOrPost); // add form parameter, if any foreach(var param in formParams) request.AddParameter(param.Key, param.Value, ParameterType.GetOrPost); // add file parameter, if any foreach(var param in fileParams) request.AddFile(param.Value.Name, param.Value.Writer, param.Value.FileName, aram.Value.ContentType);