Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat swift multipart #967

Open
wants to merge 37 commits into
base: feat-multipart
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
4d84584
Rename references
abnegate Aug 30, 2024
fcffcde
Add payload type
abnegate Aug 30, 2024
9c4388d
Update service
abnegate Aug 30, 2024
6a6ebae
Add payload functions
abnegate Aug 30, 2024
525a77c
Handle params
abnegate Aug 30, 2024
0a55932
Add multipart response hook
abnegate Aug 30, 2024
65d1f04
Add formdata response parsing
abnegate Aug 30, 2024
ac6c972
Handle request binary parts
abnegate Aug 30, 2024
b1f26ad
Update test
abnegate Aug 30, 2024
b3ebc22
Try + optional for payload to byte buffer
abnegate Aug 30, 2024
22ef7c0
Fix generic type
abnegate Aug 30, 2024
c6d4b7c
Handle more as upload types
abnegate Aug 30, 2024
dee0a85
Fix return type filter
abnegate Aug 30, 2024
8d32730
Update Apple tests
abnegate Aug 30, 2024
0bcc580
Update chunked upload for payloads
abnegate Aug 30, 2024
cb668ef
Merge remote-tracking branch 'origin/feat-multipart' into feat-swift-…
abnegate Sep 3, 2024
8887720
Add extensions module to avoid payload circular dependency
abnegate Sep 3, 2024
4576d87
Fix imports
abnegate Sep 3, 2024
1ca91b7
Fix chunked upload with payload
abnegate Sep 3, 2024
89831bb
Revert param name change
abnegate Sep 3, 2024
7fddaa7
Fix swift test
abnegate Sep 3, 2024
f067d5f
Fix Apple tests
abnegate Sep 3, 2024
7f1aab8
Add Swift 5.10 tests
abnegate Sep 3, 2024
574c2d5
Fix missing produces on methods
abnegate Sep 3, 2024
2f6cfb7
Check produces for adding accept header
abnegate Sep 3, 2024
985e4f4
Fix spec multipart response type
abnegate Sep 3, 2024
2e5f36f
Fix spec multipart required
abnegate Sep 3, 2024
4465360
Merge branch 'feat-multipart' into feat-swift-multipart
Meldiron Sep 18, 2024
a9d31db
Revert specs changes
Meldiron Sep 18, 2024
4206b8f
PR review changes
Meldiron Sep 18, 2024
8543733
Add more multipart tests
Meldiron Sep 18, 2024
58446b2
Formatter fix
Meldiron Sep 18, 2024
1c43152
Fix failing tests
Meldiron Sep 18, 2024
0098b76
Attempt to fix test
Meldiron Sep 25, 2024
b4c1bb6
Merge branch 'feat-multipart' of https://github.com/appwrite/sdk-gene…
loks0n Sep 30, 2024
5618994
Merge branch 'feat-multipart' of https://github.com/appwrite/sdk-gene…
loks0n Oct 1, 2024
505fce5
fix: go
loks0n Oct 1, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Handle more as upload types
abnegate committed Aug 30, 2024
commit c6d4b7ca03f02898659ef1c042c36b05f66ea6ad
8 changes: 4 additions & 4 deletions templates/apple/Sources/Services/Service.swift.twig
Original file line number Diff line number Diff line change
@@ -27,7 +27,7 @@ open class {{ service.name | caseUcfirst | overrideIdentifier }}: Service {
{%~ endif %}
open func {{ method.name | caseCamel | overrideIdentifier }}{% if method.responseModel | hasGenericType(spec) %}<T>{% endif %}(
{%~ for parameter in method.parameters.all %}
{{ parameter.name | caseCamel | escapeSwiftKeyword }}: {{ parameter | typeName(spec) | raw }}{% if not parameter.required or parameter.nullable %}? = nil{% endif %}{% if not loop.last or 'multipart/form-data' in method.consumes or method.responseModel | hasGenericType(spec) %},{% endif %}
{{ parameter.name | caseCamel | escapeSwiftKeyword }}: {{ parameter | typeName(spec) | raw }}{% if not parameter.required or parameter.nullable %}? = nil{% endif %}{% if not loop.last or ('multipart/form-data' in method.consumes and method.type == 'upload') or method.responseModel | hasGenericType(spec) %},{% endif %}

{%~ endfor %}
{%~ if method.responseModel | hasGenericType(spec) %}
@@ -46,7 +46,7 @@ open class {{ service.name | caseUcfirst | overrideIdentifier }}: Service {
{%~ if method.headers | length <= 0 %}
let apiHeaders: [String: String] = [:]
{%~ else %}
{% if 'multipart/form-data' in method.consumes -%} var
{% if 'multipart/form-data' in method.consumes and method.type == 'upload' -%} var
{%- else -%} let
{%- endif %} apiHeaders: [String: String] = [
{%~ if 'multipart/form-data' in method.consumes and method.type != 'upload' %}
@@ -99,7 +99,7 @@ open class {{ service.name | caseUcfirst | overrideIdentifier }}: Service {
{{ parameter.name | caseCamel | escapeSwiftKeyword }}: {{ parameter | typeName(spec) | raw }}{% if not parameter.required or parameter.nullable %}? = nil{% endif %}{% if not loop.last or 'multipart/form-data' in method.consumes %},{% endif %}

{%~ endfor %}
{%~ if 'multipart/form-data' in method.consumes %}
{%~ if 'multipart/form-data' in method.consumes and method.type == 'upload' %}
onProgress: ((UploadProgress) -> Void)? = nil
{%~ endif %}
) async throws -> {{ method | returnType(spec, '[String: AnyCodable]') | raw }} {
@@ -108,7 +108,7 @@ open class {{ service.name | caseUcfirst | overrideIdentifier }}: Service {
{{ parameter.name | caseCamel | escapeSwiftKeyword }}: {{ parameter.name | caseCamel | escapeSwiftKeyword }},
{%~ endfor %}
nestedType: [String: AnyCodable].self
{%~ if 'multipart/form-data' in method.consumes %}
{%~ if 'multipart/form-data' in method.consumes and method.type == 'upload' %}
onProgress: onProgress
{%~ endif %}
)
2 changes: 1 addition & 1 deletion templates/swift/base/params.twig
Original file line number Diff line number Diff line change
@@ -6,7 +6,7 @@
{%~ if method.parameters.query | merge(method.parameters.body) | length <= 0 %}
let apiParams: [String: Any] = [:]
{%~ else %}
{% if 'multipart/form-data' in method.consumes -%} var
{% if 'multipart/form-data' in method.consumes and method.type == 'upload' -%} var
{%- else -%} let
{%- endif %} apiParams: [String: Any?] = [
{%~ for parameter in method.parameters.query | merge(method.parameters.body) %}