You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

114 lines
3.3 KiB

2 years ago
  1. # Go API client for openapi
  2. The Seaweedfs Master Server API allows you to store blobs
  3. ## Overview
  4. This API client was generated by the [OpenAPI Generator](https://openapi-generator.tech) project. By using the [OpenAPI-spec](https://www.openapis.org/) from a remote server, you can easily generate an API client.
  5. - API version: 3.43.0
  6. - Package version: 1.0.0
  7. - Build package: org.openapitools.codegen.languages.GoClientCodegen
  8. ## Installation
  9. Install the following dependencies:
  10. ```shell
  11. go get github.com/stretchr/testify/assert
  12. go get golang.org/x/net/context
  13. ```
  14. Put the package under your project folder and add the following in import:
  15. ```golang
  16. import openapi "github.com/GIT_USER_ID/GIT_REPO_ID"
  17. ```
  18. To use a proxy, set the environment variable `HTTP_PROXY`:
  19. ```golang
  20. os.Setenv("HTTP_PROXY", "http://proxy_name:proxy_port")
  21. ```
  22. ## Configuration of Server URL
  23. Default configuration comes with `Servers` field that contains server objects as defined in the OpenAPI specification.
  24. ### Select Server Configuration
  25. For using other server than the one defined on index 0 set context value `sw.ContextServerIndex` of type `int`.
  26. ```golang
  27. ctx := context.WithValue(context.Background(), openapi.ContextServerIndex, 1)
  28. ```
  29. ### Templated Server URL
  30. Templated server URL is formatted using default variables from configuration or from context value `sw.ContextServerVariables` of type `map[string]string`.
  31. ```golang
  32. ctx := context.WithValue(context.Background(), openapi.ContextServerVariables, map[string]string{
  33. "basePath": "v2",
  34. })
  35. ```
  36. Note, enum values are always validated and all unused variables are silently ignored.
  37. ### URLs Configuration per Operation
  38. Each operation can use different server URL defined using `OperationServers` map in the `Configuration`.
  39. An operation is uniquely identified by `"{classname}Service.{nickname}"` string.
  40. Similar rules for overriding default operation server index and variables applies by using `sw.ContextOperationServerIndices` and `sw.ContextOperationServerVariables` context maps.
  41. ```golang
  42. ctx := context.WithValue(context.Background(), openapi.ContextOperationServerIndices, map[string]int{
  43. "{classname}Service.{nickname}": 2,
  44. })
  45. ctx = context.WithValue(context.Background(), openapi.ContextOperationServerVariables, map[string]map[string]string{
  46. "{classname}Service.{nickname}": {
  47. "port": "8443",
  48. },
  49. })
  50. ```
  51. ## Documentation for API Endpoints
  52. All URIs are relative to *https://127.0.0.1:9333*
  53. Class | Method | HTTP request | Description
  54. ------------ | ------------- | ------------- | -------------
  55. *DefaultApi* | [**DirAssign**](docs/DefaultApi.md#dirassign) | **Get** /dir/assign | Assign a file key
  56. *DefaultApi* | [**DirLookup**](docs/DefaultApi.md#dirlookup) | **Get** /dir/lookup | Lookup volume
  57. ## Documentation For Models
  58. - [FileKey](docs/FileKey.md)
  59. - [Location](docs/Location.md)
  60. ## Documentation For Authorization
  61. Endpoints do not require authorization.
  62. ## Documentation for Utility Methods
  63. Due to the fact that model structure members are all pointers, this package contains
  64. a number of utility functions to easily obtain pointers to values of basic types.
  65. Each of these functions takes a value of the given basic type and returns a pointer to it:
  66. * `PtrBool`
  67. * `PtrInt`
  68. * `PtrInt32`
  69. * `PtrInt64`
  70. * `PtrFloat`
  71. * `PtrFloat32`
  72. * `PtrFloat64`
  73. * `PtrString`
  74. * `PtrTime`
  75. ## Author