-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRepositoryOwnerQueryBuilder.scala
More file actions
63 lines (56 loc) · 2.03 KB
/
Copy pathRepositoryOwnerQueryBuilder.scala
File metadata and controls
63 lines (56 loc) · 2.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
package builders.queryBuilders
import builders.QueryBuilder
import com.typesafe.scalalogging.LazyLogging
/**
* Query builder for building sub-fields for a repository owner. Possible subfields and
* * connections given in [[https://developer.github.com/v4/object/repositoryowner/]]
*
* @param scalars list of scalars
* @param fields list of fields
* @param connections list of connections
*/
case class RepositoryOwnerQueryBuilder(scalars: List[String] = List(),
fields: List[QueryBuilder] = List(),
connections: List[QueryBuilder] = List())
extends QueryBuilder with LazyLogging {
// overridden top query
override var topQuery: String = "owner"
/**
* Returns a new [[RepositoryOwnerQueryBuilder]] object with a modified top query
*
* @param queryBuilder object of type [[RepositoryOwnerQueryBuilder]]
* @return object of type [[RepositoryOwnerQueryBuilder]]
*/
private def modifyTopQuery(queryBuilder: RepositoryOwnerQueryBuilder): RepositoryOwnerQueryBuilder = {
queryBuilder.topQuery = this.topQuery
queryBuilder
}
/**
* Includes the '''login''' field in the repository owner query
*
* @return object of type [[RepositoryOwnerQueryBuilder]]
*/
def includeLogin(): RepositoryOwnerQueryBuilder = {
logger.info("Including login")
val repositoryOwnerQueryBuilder: RepositoryOwnerQueryBuilder = new RepositoryOwnerQueryBuilder(
"login" :: this.scalars,
this.fields,
this.connections
)
this.modifyTopQuery(repositoryOwnerQueryBuilder)
}
/**
* Includes the '''url''' field in the repository owner query
*
* @return object of type [[RepositoryOwnerQueryBuilder]]
*/
def includeUrl(): RepositoryOwnerQueryBuilder = {
logger.info("Including url")
val repositoryOwnerQueryBuilder: RepositoryOwnerQueryBuilder = new RepositoryOwnerQueryBuilder(
"url" :: this.scalars,
this.fields,
this.connections
)
this.modifyTopQuery(repositoryOwnerQueryBuilder)
}
}