Documentation
¶
Overview ¶
Package apis contains the API groups for the admin API.
Index ¶
- Constants
- Variables
- type API
- func (api *API) CreatePost(ctx context.Context, in *postsv1.CreatePostRequest) (*postsv1.CreatePostResponse, error)
- func (api *API) DeleteAsset(ctx context.Context, in *postsv1.DeleteAssetRequest) (*postsv1.DeleteAssetResponse, error)
- func (api *API) DeletePost(ctx context.Context, in *postsv1.DeletePostRequest) (*postsv1.DeletePostResponse, error)
- func (api *API) GetAsset(ctx context.Context, in *postsv1.GetAssetRequest) (*postsv1.GetAssetResponse, error)
- func (api *API) GetPost(ctx context.Context, in *postsv1.GetPostRequest) (*postsv1.GetPostResponse, error)
- func (api *API) ListAssets(ctx context.Context, in *postsv1.ListAssetsRequest) (*postsv1.ListAssetsResponse, error)
- func (api *API) ListPosts(ctx context.Context, in *postsv1.ListPostsRequest) (*postsv1.ListPostsResponse, error)
- func (api *API) NewAsset(ctx context.Context, in *postsv1.NewAssetRequest) (*postsv1.NewAssetResponse, error)
- func (api *API) PublishPost(ctx context.Context, in *postsv1.PublishPostRequest) (*postsv1.PublishPostResponse, error)
- func (api *API) Serve() error
- func (api *API) UnpublishPost(ctx context.Context, in *postsv1.UnpublishPostRequest) (*postsv1.UnpublishPostResponse, error)
- func (api *API) UpdateAsset(ctx context.Context, in *postsv1.UpdateAssetRequest) (*postsv1.UpdateAssetResponse, error)
- func (api *API) UpdatePost(ctx context.Context, in *postsv1.UpdatePostRequest) (*postsv1.UpdatePostResponse, error)
- type Opt
- func WithDataStore(store storage.DataStore) Opt
- func WithDev(dev bool) Opt
- func WithFileStore(store storage.FileStore) Opt
- func WithLogger(logger *zap.Logger) Opt
- func WithPrivateAssetGetURLExpiry(expiry time.Duration) Opt
- func WithPublicAssetGetURLExpiry(expiry time.Duration) Opt
- func WithRefreshAssetURLExpiry(expiry time.Duration) Opt
- func WithServerOptions(options ...grpc.ServerOption) Opt
Constants ¶
const ( // PermissionReadPosts is the permission required to read a post. PermissionReadPosts = "read:posts" // PermissionWritePosts is the permission required to create a post. PermissionWritePosts = "write:posts" // PermissionPublishPosts is the permission required to publish a post. PermissionPublishPosts = "publish:posts" // PermissionReadAssets is the permission required to read an asset. PermissionReadAssets = "read:assets" // PermissionWriteAssets is the permission required to create an asset. PermissionWriteAssets = "write:assets" )
Variables ¶
var ErrPostIDRequired = errors.New("post ID is required")
ErrPostIDRequired is returned when a post ID is required but not provided.
Functions ¶
This section is empty.
Types ¶
type API ¶
type API struct { postsv1.UnimplementedPostsManagerServiceServer // contains filtered or unexported fields }
API is the grpc server implementation
func (*API) CreatePost ¶
func (api *API) CreatePost(ctx context.Context, in *postsv1.CreatePostRequest) (*postsv1.CreatePostResponse, error)
CreatePost implements adminapis.PostsManagerServer.CreatePost
func (*API) DeleteAsset ¶
func (api *API) DeleteAsset(ctx context.Context, in *postsv1.DeleteAssetRequest) (*postsv1.DeleteAssetResponse, error)
DeleteAsset deletes an asset, implements adminapis.PostsManagerServer.DeleteAsset
func (*API) DeletePost ¶
func (api *API) DeletePost(ctx context.Context, in *postsv1.DeletePostRequest) (*postsv1.DeletePostResponse, error)
DeletePost implements adminapis.PostsManagerServer.DeletePost
func (*API) GetAsset ¶
func (api *API) GetAsset(ctx context.Context, in *postsv1.GetAssetRequest) (*postsv1.GetAssetResponse, error)
GetAsset retrieves an asset by its ID, implements adminapis.PostsManagerServer.GetAsset
func (*API) GetPost ¶
func (api *API) GetPost(ctx context.Context, in *postsv1.GetPostRequest) (*postsv1.GetPostResponse, error)
GetPost implements adminapis.PostsManagerServer.GetPost
func (*API) ListAssets ¶
func (api *API) ListAssets(ctx context.Context, in *postsv1.ListAssetsRequest) (*postsv1.ListAssetsResponse, error)
ListAssets lists assets, implements adminapis.PostsManagerServer.ListAssets
func (*API) ListPosts ¶
func (api *API) ListPosts(ctx context.Context, in *postsv1.ListPostsRequest) (*postsv1.ListPostsResponse, error)
ListPosts implements adminapis.PostsManagerServer.ListPosts
func (*API) NewAsset ¶
func (api *API) NewAsset(ctx context.Context, in *postsv1.NewAssetRequest) (*postsv1.NewAssetResponse, error)
NewAsset creates a new asset, implements adminapis.PostsManagerServer.NewAsset
func (*API) PublishPost ¶
func (api *API) PublishPost(ctx context.Context, in *postsv1.PublishPostRequest) (*postsv1.PublishPostResponse, error)
PublishPost implements adminapis.PostsManagerServer.PublishPost
func (*API) UnpublishPost ¶
func (api *API) UnpublishPost(ctx context.Context, in *postsv1.UnpublishPostRequest) (*postsv1.UnpublishPostResponse, error)
UnpublishPost implements adminapis.PostsManagerServer.UnpublishPost
func (*API) UpdateAsset ¶
func (api *API) UpdateAsset(ctx context.Context, in *postsv1.UpdateAssetRequest) (*postsv1.UpdateAssetResponse, error)
UpdateAsset updates an asset, implements adminapis.PostsManagerServer.UpdateAsset
func (*API) UpdatePost ¶
func (api *API) UpdatePost(ctx context.Context, in *postsv1.UpdatePostRequest) (*postsv1.UpdatePostResponse, error)
UpdatePost implements adminapis.PostsManagerServer.UpdatePost
type Opt ¶
type Opt func(*API)
Opt is a functional option for API
func WithDataStore ¶
WithDataStore sets the store for the API
func WithFileStore ¶
WithFileStore sets the file store for the API
func WithPrivateAssetGetURLExpiry ¶
WithPrivateAssetGetURLExpiry sets the expiry duration for private asset get URLs
func WithPublicAssetGetURLExpiry ¶
WithPublicAssetGetURLExpiry sets the expiry duration for public asset get URLs
func WithRefreshAssetURLExpiry ¶
WithRefreshAssetURLExpiry sets the expiry duration for refresh asset URLs
func WithServerOptions ¶
func WithServerOptions(options ...grpc.ServerOption) Opt
WithServerOptions sets the grpc server options for the API