Skip to content

Commit

Permalink
Merge pull request #28 from owenrumney/add-additionalq-query
Browse files Browse the repository at this point in the history
Add additional query args
  • Loading branch information
streetturtle authored Sep 16, 2024
2 parents 4c1ded8 + 9247401 commit b473cee
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 4 deletions.
1 change: 1 addition & 0 deletions pullBar/Extensions/DefaultsExtensions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import Defaults
extension Defaults.Keys {
static let githubApiBaseUrl = Key<String>("githubApiBaseUrl", default: "https://api.github.com")
static let githubUsername = Key<String>("githubUsername", default: "")
static let githubAdditionalQuery = Key<String>("githubAdditionalQuery", default:"")

static let showAssigned = Key<Bool>("showAssigned", default: false)
static let showCreated = Key<Bool>("showCreated", default: false)
Expand Down
7 changes: 4 additions & 3 deletions pullBar/GitHub/GitHubClient.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ public class GitHubClient {

@Default(.githubApiBaseUrl) var githubApiBaseUrl
@Default(.githubUsername) var githubUsername
@Default(.githubAdditionalQuery) var githubAdditionalQuery
@FromKeychain(.githubToken) var githubToken

@Default(.buildType) var buildType
Expand All @@ -29,7 +30,7 @@ public class GitHubClient {
.accept("application/json")
]

let graphQlQuery = buildGraphQlQuery(queryString: "is:open is:pr assignee:\(githubUsername) archived:false")
let graphQlQuery = buildGraphQlQuery(queryString: "is:open is:pr assignee:\(githubUsername) archived:false \(githubAdditionalQuery)")

let parameters = [
"query": graphQlQuery,
Expand Down Expand Up @@ -60,7 +61,7 @@ public class GitHubClient {
.authorization(bearerToken: githubToken),
.accept("application/json")
]
let graphQlQuery = buildGraphQlQuery(queryString: "is:open is:pr author:\(githubUsername) archived:false")
let graphQlQuery = buildGraphQlQuery(queryString: "is:open is:pr author:\(githubUsername) archived:false \(githubAdditionalQuery)")

let parameters = [
"query": graphQlQuery,
Expand Down Expand Up @@ -90,7 +91,7 @@ public class GitHubClient {
.authorization(bearerToken: githubToken),
.accept("application/json")
]
let graphQlQuery = buildGraphQlQuery(queryString: "is:open is:pr review-requested:\(githubUsername) archived:false")
let graphQlQuery = buildGraphQlQuery(queryString: "is:open is:pr review-requested:\(githubUsername) archived:false \(githubAdditionalQuery)")

let parameters = [
"query": graphQlQuery,
Expand Down
10 changes: 9 additions & 1 deletion pullBar/Views/PreferencesView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ struct PreferencesView: View {

@Default(.githubApiBaseUrl) var githubApiBaseUrl
@Default(.githubUsername) var githubUsername
@Default(.githubAdditionalQuery) var githubAdditionalQuery
@FromKeychain(.githubToken) var githubToken

@Default(.showAssigned) var showAssigned
Expand Down Expand Up @@ -52,7 +53,14 @@ struct PreferencesView: View {
.textContentType(.password)
.frame(width: 200)
}

HStack(alignment: .center) {
Text("Additional Query:").frame(width: 120, alignment: .trailing)
TextField("", text: $githubAdditionalQuery)
.textFieldStyle(RoundedBorderTextFieldStyle())
.disableAutocorrection(true)
.textContentType(.password)
.frame(width: 380)
}
HStack(alignment: .center) {
Text("Token:").frame(width: 120, alignment: .trailing)
VStack(alignment: .leading) {
Expand Down

0 comments on commit b473cee

Please sign in to comment.