Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
A
Api
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
Public iOS projects
Api
Commits
716d034e
Commit
716d034e
authored
Aug 25, 2016
by
Mauro E. Bender
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Close #9 - Add PUT, PATCH and DELETE methods to the API
parent
981e1391
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
0 deletions
+21
-0
Api/Classes/Api.swift
Api/Classes/Api.swift
+21
-0
No files found.
Api/Classes/Api.swift
View file @
716d034e
...
...
@@ -49,6 +49,27 @@ public class Api {
headers
:
headers
,
completion
:
completion
)
}
public
func
put
(
path
:
String
,
parameters
:
[
String
:
AnyObject
]?
=
nil
,
encoding
:
ParameterEncoding
=
.
URL
,
headers
:
[
String
:
String
]?
=
nil
,
completion
:
Response
<
AnyObject
,
NSError
>
->
Void
)
{
return
request
(
.
PUT
,
path
:
path
,
parameters
:
parameters
,
encoding
:
encoding
,
headers
:
headers
,
completion
:
completion
)
}
public
func
patch
(
path
:
String
,
parameters
:
[
String
:
AnyObject
]?
=
nil
,
encoding
:
ParameterEncoding
=
.
URL
,
headers
:
[
String
:
String
]?
=
nil
,
completion
:
Response
<
AnyObject
,
NSError
>
->
Void
)
{
return
request
(
.
PATCH
,
path
:
path
,
parameters
:
parameters
,
encoding
:
encoding
,
headers
:
headers
,
completion
:
completion
)
}
public
func
delete
(
path
:
String
,
parameters
:
[
String
:
AnyObject
]?
=
nil
,
encoding
:
ParameterEncoding
=
.
URL
,
headers
:
[
String
:
String
]?
=
nil
,
completion
:
Response
<
AnyObject
,
NSError
>
->
Void
)
{
return
request
(
.
DELETE
,
path
:
path
,
parameters
:
parameters
,
encoding
:
encoding
,
headers
:
headers
,
completion
:
completion
)
}
func
urlForPath
(
path
:
String
)
->
NSURL
{
return
apiURL
.
URLByAppendingPathComponent
(
path
)
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment