Files
openapi-go-answer/docs/UploadAPI.md
2023-09-26 16:20:01 +08:00

3.8 KiB

\UploadAPI

All URIs are relative to http://localhost

Method HTTP request Description
AnswerApiV1FilePost Post /answer/api/v1/file upload file
AnswerApiV1PostRenderPost Post /answer/api/v1/post/render render post content

AnswerApiV1FilePost

AnswerApiV1FilePost200Response AnswerApiV1FilePost(ctx).Source(source).File(file).Execute()

upload file

Example

package main

import (
    "context"
    "fmt"
    "os"
    openapiclient "git.ncc.cx/package/openapi-go-answer"
)

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

Authorization

ApiKeyAuth

HTTP request headers

  • Content-Type: multipart/form-data
  • Accept: /

[Back to top] [Back to API list] [Back to Model list] [Back to README]

AnswerApiV1PostRenderPost

HandlerRespBody AnswerApiV1PostRenderPost(ctx).Data(data).Execute()

render post content

Example

package main

import (
    "context"
    "fmt"
    "os"
    openapiclient "git.ncc.cx/package/openapi-go-answer"
)

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 PostRenderReq

Return type

HandlerRespBody

Authorization

ApiKeyAuth

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]