Debian Codegraph @

pkg/api/structs.go

raw
1 // Copyright 2024 The Archivista Contributors
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14
15 package api
16
17 type GraphQLError struct {
18 Message string `json:"message"`
19 }
20
21 type GraphQLResponseGeneric[T any] struct {
22 Data T `json:"data,omitempty"`
23 Errors []GraphQLError `json:"errors,omitempty"`
24 }
25
26 type GraphQLRequestBodyGeneric[TVars any] struct {
27 Query string `json:"query"`
28 Variables TVars `json:"variables,omitempty"`
29 }
30
31 type RetrieveSubjectVars struct {
32 Gitoid string `json:"gitoid"`
33 }
34
35 type SearchVars struct {
36 Algorithm string `json:"algo"`
37 Digest string `json:"digest"`
38 }
39
40 type RetrieveSubjectResults struct {
41 Subjects Subjects `json:"subjects"`
42 }
43
44 type Subjects struct {
45 Edges []SubjectEdge `json:"edges"`
46 }
47
48 type SubjectEdge struct {
49 Node SubjectNode `json:"node"`
50 }
51
52 type SubjectNode struct {
53 Name string `json:"name"`
54 SubjectDigests []SubjectDigest `json:"subjectDigests"`
55 }
56
57 type SubjectDigest struct {
58 Algorithm string `json:"algorithm"`
59 Value string `json:"value"`
60 }
61
62 type SearchResults struct {
63 Dsses DSSES `json:"dsses"`
64 }
65
66 type DSSES struct {
67 Edges []SearchEdge `json:"edges"`
68 }
69
70 type SearchEdge struct {
71 Node SearchNode `json:"node"`
72 }
73
74 type SearchNode struct {
75 GitoidSha256 string `json:"gitoidSha256"`
76 Statement Statement `json:"statement"`
77 }
78
79 type Statement struct {
80 AttestationCollection AttestationCollection `json:"attestationCollections"`
81 }
82
83 type AttestationCollection struct {
84 Name string `json:"name"`
85 Attestations []Attestation `json:"attestations"`
86 }
87
88 type Attestation struct {
89 Type string `json:"type"`
90 }