-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactoring pkg Archivista API and include new http client for Archiv…
…ista (#424) * refactor: implement a new pkg/api desing Signed-off-by: Kairo Araujo <[email protected]> * feat: Archivista HTTP client add a pkg with a HTTP client for Archivista using the pkg API Signed-off-by: Kairo Araujo <[email protected]> * docs: add http-client documentation Signed-off-by: Kairo Araujo <[email protected]> --------- Signed-off-by: Kairo Araujo <[email protected]> Signed-off-by: Kairo Araujo <[email protected]>
- Loading branch information
1 parent
81fdcd7
commit 51bb817
Showing
7 changed files
with
739 additions
and
34 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
// Copyright 2024 The Archivista Contributors | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
package api | ||
|
||
type GraphQLError struct { | ||
Message string `json:"message"` | ||
} | ||
|
||
type GraphQLResponseGeneric[T any] struct { | ||
Data T `json:"data,omitempty"` | ||
Errors []GraphQLError `json:"errors,omitempty"` | ||
} | ||
|
||
type GraphQLRequestBodyGeneric[TVars any] struct { | ||
Query string `json:"query"` | ||
Variables TVars `json:"variables,omitempty"` | ||
} | ||
|
||
type RetrieveSubjectVars struct { | ||
Gitoid string `json:"gitoid"` | ||
} | ||
|
||
type SearchVars struct { | ||
Algorithm string `json:"algo"` | ||
Digest string `json:"digest"` | ||
} | ||
|
||
type RetrieveSubjectResults struct { | ||
Subjects Subjects `json:"subjects"` | ||
} | ||
|
||
type Subjects struct { | ||
Edges []SubjectEdge `json:"edges"` | ||
} | ||
|
||
type SubjectEdge struct { | ||
Node SubjectNode `json:"node"` | ||
} | ||
|
||
type SubjectNode struct { | ||
Name string `json:"name"` | ||
SubjectDigests []SubjectDigest `json:"subjectDigests"` | ||
} | ||
|
||
type SubjectDigest struct { | ||
Algorithm string `json:"algorithm"` | ||
Value string `json:"value"` | ||
} | ||
|
||
type SearchResults struct { | ||
Dsses DSSES `json:"dsses"` | ||
} | ||
|
||
type DSSES struct { | ||
Edges []SearchEdge `json:"edges"` | ||
} | ||
|
||
type SearchEdge struct { | ||
Node SearchNode `json:"node"` | ||
} | ||
|
||
type SearchNode struct { | ||
GitoidSha256 string `json:"gitoidSha256"` | ||
Statement Statement `json:"statement"` | ||
} | ||
|
||
type Statement struct { | ||
AttestationCollection AttestationCollection `json:"attestationCollections"` | ||
} | ||
|
||
type AttestationCollection struct { | ||
Name string `json:"name"` | ||
Attestations []Attestation `json:"attestations"` | ||
} | ||
|
||
type Attestation struct { | ||
Type string `json:"type"` | ||
} |
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
Oops, something went wrong.