Files
openapi-go-answer/docs/UploadApi.md
2023-08-22 10:37:28 +08:00

145 lines
3.8 KiB
Markdown

# \UploadApi
All URIs are relative to *http://localhost*
Method | HTTP request | Description
------------- | ------------- | -------------
[**AnswerApiV1FilePost**](UploadApi.md#AnswerApiV1FilePost) | **Post** /answer/api/v1/file | upload file
[**AnswerApiV1PostRenderPost**](UploadApi.md#AnswerApiV1PostRenderPost) | **Post** /answer/api/v1/post/render | render post content
## AnswerApiV1FilePost
> AnswerApiV1FilePost200Response AnswerApiV1FilePost(ctx).Source(source).File(file).Execute()
upload file
### Example
```go
package main
import (
"context"
"fmt"
"os"
openapiclient "github.com/GIT_USER_ID/GIT_REPO_ID"
)
func main() {
source := "source_example" // string | identify the source of the file upload
file := os.NewFile(1234, "some_file") // *os.File | file
configuration := openapiclient.NewConfiguration()
apiClient := openapiclient.NewAPIClient(configuration)
resp, r, err := apiClient.UploadApi.AnswerApiV1FilePost(context.Background()).Source(source).File(file).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `UploadApi.AnswerApiV1FilePost``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
// response from `AnswerApiV1FilePost`: AnswerApiV1FilePost200Response
fmt.Fprintf(os.Stdout, "Response from `UploadApi.AnswerApiV1FilePost`: %v\n", resp)
}
```
### Path Parameters
### Other Parameters
Other parameters are passed through a pointer to a apiAnswerApiV1FilePostRequest struct via the builder pattern
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**source** | **string** | identify the source of the file upload |
**file** | ***os.File** | file |
### Return type
[**AnswerApiV1FilePost200Response**](AnswerApiV1FilePost200Response.md)
### Authorization
[ApiKeyAuth](../README.md#ApiKeyAuth)
### HTTP request headers
- **Content-Type**: multipart/form-data
- **Accept**: */*
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints)
[[Back to Model list]](../README.md#documentation-for-models)
[[Back to README]](../README.md)
## AnswerApiV1PostRenderPost
> HandlerRespBody AnswerApiV1PostRenderPost(ctx).Data(data).Execute()
render post content
### Example
```go
package main
import (
"context"
"fmt"
"os"
openapiclient "github.com/GIT_USER_ID/GIT_REPO_ID"
)
func main() {
data := *openapiclient.NewSchemaPostRenderReq() // SchemaPostRenderReq | PostRenderReq
configuration := openapiclient.NewConfiguration()
apiClient := openapiclient.NewAPIClient(configuration)
resp, r, err := apiClient.UploadApi.AnswerApiV1PostRenderPost(context.Background()).Data(data).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `UploadApi.AnswerApiV1PostRenderPost``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
// response from `AnswerApiV1PostRenderPost`: HandlerRespBody
fmt.Fprintf(os.Stdout, "Response from `UploadApi.AnswerApiV1PostRenderPost`: %v\n", resp)
}
```
### Path Parameters
### Other Parameters
Other parameters are passed through a pointer to a apiAnswerApiV1PostRenderPostRequest struct via the builder pattern
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**data** | [**SchemaPostRenderReq**](SchemaPostRenderReq.md) | PostRenderReq |
### Return type
[**HandlerRespBody**](HandlerRespBody.md)
### Authorization
[ApiKeyAuth](../README.md#ApiKeyAuth)
### HTTP request headers
- **Content-Type**: application/json
- **Accept**: application/json
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints)
[[Back to Model list]](../README.md#documentation-for-models)
[[Back to README]](../README.md)