-
Notifications
You must be signed in to change notification settings - Fork 25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactoring: Server API service #152
Merged
Merged
Changes from 4 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
dc03aea
refactor: rename var `mysql*` to `sql*`
kairoaraujo be5e8da
refactor: simplify archivista, move API to server
kairoaraujo 16ce17a
refactoring: rename store APIs to upload
kairoaraujo 804bed9
update refactoring done on API
kairoaraujo 0a89fac
fixup! refactoring: rename store APIs to upload
kairoaraujo aa5d56f
tests: Add unit tests for server.go
kairoaraujo 8e3f114
fix: Add more consistent HTTP errors
kairoaraujo 1aef60c
fixup! refactor: simplify archivista, move API to server
kairoaraujo File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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,230 @@ | ||
// Package docs Code generated by swaggo/swag. DO NOT EDIT | ||
package docs | ||
|
||
import "github.com/swaggo/swag" | ||
|
||
const docTemplate = `{ | ||
"schemes": {{ marshal .Schemes }}, | ||
"swagger": "2.0", | ||
"info": { | ||
"description": "{{escape .Description}}", | ||
"title": "{{.Title}}", | ||
"contact": { | ||
"name": "Archivista Contributors", | ||
"url": "https://github.com/in-toto/archivista/issues/new" | ||
}, | ||
"license": { | ||
"url": "https://opensource.org/licenses/Apache-2" | ||
}, | ||
"version": "{{.Version}}" | ||
}, | ||
"host": "{{.Host}}", | ||
"basePath": "{{.BasePath}}", | ||
"paths": { | ||
"/donwload/{gitoid}": { | ||
"post": { | ||
"description": "download an attestation", | ||
"produces": [ | ||
"application/json" | ||
], | ||
"summary": "Download", | ||
"deprecated": true, | ||
"responses": { | ||
"200": { | ||
"description": "OK", | ||
"schema": { | ||
"$ref": "#/definitions/dsse.Envelope" | ||
} | ||
} | ||
} | ||
} | ||
}, | ||
"/upload": { | ||
"post": { | ||
"description": "stores an attestation", | ||
"produces": [ | ||
"application/json" | ||
], | ||
"summary": "Store", | ||
"deprecated": true, | ||
"responses": { | ||
"200": { | ||
"description": "OK", | ||
"schema": { | ||
"$ref": "#/definitions/api.StoreResponse" | ||
} | ||
} | ||
} | ||
} | ||
}, | ||
"/v1/donwload/{gitoid}": { | ||
"post": { | ||
"description": "download an attestation", | ||
"produces": [ | ||
"application/json" | ||
], | ||
"tags": [ | ||
"attestation" | ||
], | ||
"summary": "Download", | ||
"responses": { | ||
"200": { | ||
"description": "OK", | ||
"schema": { | ||
"$ref": "#/definitions/dsse.Envelope" | ||
} | ||
} | ||
} | ||
} | ||
}, | ||
"/v1/query": { | ||
"post": { | ||
"description": "GraphQL query", | ||
"produces": [ | ||
"application/json" | ||
], | ||
"tags": [ | ||
"graphql" | ||
], | ||
"summary": "Query GraphQL", | ||
"responses": { | ||
"200": { | ||
"description": "OK", | ||
"schema": { | ||
"$ref": "#/definitions/archivista.Resolver" | ||
} | ||
} | ||
} | ||
} | ||
}, | ||
"/v1/upload": { | ||
"post": { | ||
"description": "stores an attestation", | ||
"produces": [ | ||
"application/json" | ||
], | ||
"tags": [ | ||
"attestation" | ||
], | ||
"summary": "Store", | ||
"responses": { | ||
"200": { | ||
"description": "OK", | ||
"schema": { | ||
"$ref": "#/definitions/api.StoreResponse" | ||
} | ||
} | ||
} | ||
} | ||
} | ||
}, | ||
"definitions": { | ||
"api.StoreResponse": { | ||
"type": "object", | ||
"properties": { | ||
"gitoid": { | ||
"type": "string" | ||
} | ||
} | ||
}, | ||
"archivista.Resolver": { | ||
"type": "object" | ||
}, | ||
"dsse.Envelope": { | ||
"type": "object", | ||
"properties": { | ||
"payload": { | ||
"type": "array", | ||
"items": { | ||
"type": "integer" | ||
} | ||
}, | ||
"payloadType": { | ||
"type": "string" | ||
}, | ||
"signatures": { | ||
"type": "array", | ||
"items": { | ||
"$ref": "#/definitions/dsse.Signature" | ||
} | ||
} | ||
} | ||
}, | ||
"dsse.Signature": { | ||
"type": "object", | ||
"properties": { | ||
"certificate": { | ||
"type": "array", | ||
"items": { | ||
"type": "integer" | ||
} | ||
}, | ||
"intermediates": { | ||
"type": "array", | ||
"items": { | ||
"type": "array", | ||
"items": { | ||
"type": "integer" | ||
} | ||
} | ||
}, | ||
"keyid": { | ||
"type": "string" | ||
}, | ||
"sig": { | ||
"type": "array", | ||
"items": { | ||
"type": "integer" | ||
} | ||
}, | ||
"timestamps": { | ||
"type": "array", | ||
"items": { | ||
"$ref": "#/definitions/dsse.SignatureTimestamp" | ||
} | ||
} | ||
} | ||
}, | ||
"dsse.SignatureTimestamp": { | ||
"type": "object", | ||
"properties": { | ||
"data": { | ||
"type": "array", | ||
"items": { | ||
"type": "integer" | ||
} | ||
}, | ||
"type": { | ||
"$ref": "#/definitions/dsse.SignatureTimestampType" | ||
} | ||
} | ||
}, | ||
"dsse.SignatureTimestampType": { | ||
"type": "string", | ||
"enum": [ | ||
"tsp" | ||
], | ||
"x-enum-varnames": [ | ||
"TimestampRFC3161" | ||
] | ||
} | ||
} | ||
}` | ||
|
||
// SwaggerInfo holds exported Swagger Info so clients can modify it | ||
var SwaggerInfo = &swag.Spec{ | ||
Version: "v1", | ||
Host: "", | ||
BasePath: "", | ||
Schemes: []string{}, | ||
Title: "Archivista API", | ||
Description: "Archivista API", | ||
InfoInstanceName: "swagger", | ||
SwaggerTemplate: docTemplate, | ||
LeftDelim: "{{", | ||
RightDelim: "}}", | ||
} | ||
|
||
func init() { | ||
swag.Register(SwaggerInfo.InstanceName(), SwaggerInfo) | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we pin this to
v1.16.2
instead of latest.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just pushed a --fixup :)