-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(core): added document content, added basic Swift generated content
- Loading branch information
1 parent
2816a3e
commit 2d144ff
Showing
7 changed files
with
104 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
public enum FeedType: String { | ||
case HOT = "HOT" | ||
case NEW = "NEW" | ||
case TOP = "TOP" | ||
} | ||
|
||
public struct Entry: GraphQLMapConvertible { | ||
public var fieldsMap: GraphQLMap | ||
|
||
public init(repository: Repository, postedBy: User, createdAt: Float, score: Int, hotScore: Float, comments: [Comment], commentCount: Int, id: Int, vote: Vote) { | ||
fieldsMap = ["repository": repository, "postedBy": postedBy, "createdAt": createdAt, "score": score, "hotScore": hotScore, "comments": comments, "commentCount": commentCount, "id": id, "vote": vote] | ||
} | ||
} | ||
|
||
public struct Repository: GraphQLMapConvertible { | ||
public var fieldsMap: GraphQLMap | ||
|
||
public init(name: String, full_name: String, description: String?, html_url: String, stargazers_count: Int, open_issues_count: Int?, owner: User?) { | ||
fieldsMap = ["name": name, "full_name": full_name, "description": description, "html_url": html_url, "stargazers_count": stargazers_count, "open_issues_count": open_issues_count, "owner": owner] | ||
} | ||
} | ||
|
||
public struct User: GraphQLMapConvertible { | ||
public var fieldsMap: GraphQLMap | ||
|
||
public init(login: String, avatar_url: String, html_url: String) { | ||
fieldsMap = ["login": login, "avatar_url": avatar_url, "html_url": html_url] | ||
} | ||
} | ||
|
||
public struct Comment: GraphQLMapConvertible { | ||
public var fieldsMap: GraphQLMap | ||
|
||
public init(id: Int, postedBy: User, createdAt: Float, content: String, repoName: String) { | ||
fieldsMap = ["id": id, "postedBy": postedBy, "createdAt": createdAt, "content": content, "repoName": repoName] | ||
} | ||
} | ||
|
||
public struct Vote: GraphQLMapConvertible { | ||
public var fieldsMap: GraphQLMap | ||
|
||
public init(vote_value: Int) { | ||
fieldsMap = ["vote_value": vote_value] | ||
} | ||
} | ||
|
||
public struct A: GraphQLMapConvertible { | ||
public var fieldsMap: GraphQLMap | ||
|
||
public init(test: MyType) { | ||
fieldsMap = ["test": test] | ||
} | ||
} | ||
|
||
public enum VoteType: String { | ||
case UP = "UP" | ||
case DOWN = "DOWN" | ||
case CANCEL = "CANCEL" | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"strategy": "SINGLE_FILE", | ||
"template": "./template.handlebars", | ||
"primitives": { | ||
"String": "String", | ||
"Int": "Int", | ||
"Float": "Float", | ||
"Boolean": "Bool", | ||
"ID": "String" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
{{#each models ~}} | ||
{{#if isObject ~}} | ||
public struct {{ name }}: GraphQLMapConvertible { | ||
public var fieldsMap: GraphQLMap | ||
|
||
public init({{#each fields ~}}{{ name }}: {{#if isArray}}[{{/if}}{{ type }}{{#if isArray}}]{{/if}}{{#unless isRequired}}?{{/unless}}{{#unless @last}}, {{/unless}}{{/each ~}}) { | ||
fieldsMap = [{{#each fields ~}}"{{ name }}": {{ name }}{{#unless @last}}, {{/unless}}{{/each ~}}] | ||
} | ||
} | ||
|
||
{{/if ~}} | ||
|
||
{{#if isEnum}} | ||
public enum {{ name }}: String { | ||
{{#each enumValues }} | ||
case {{name}} = "{{ value }}" | ||
{{/each}} | ||
} | ||
|
||
{{/if ~}} | ||
{{/each ~}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters