Documentation
¶
Index ¶
- type AccountSvc
- type AccountSvcConfig
- type GetAccountFaviconURLEndpoint
- type GetAccountFaviconURLRequest
- type GetAccountLogoURLEndpoint
- type GetAccountLogoURLRequest
- type RetrieveAccountBySlugEndpoint
- type RetrieveAccountBySlugRequest
- type RetrieveAccountEndpoint
- type RetrieveAccountRequest
- type RetrievePortalProfileEndpoint
- type RetrievePortalProfileRequest
- type UpdateAccountEndpoint
- type UpdateAccountRequest
- type UploadAccountFaviconEndpoint
- type UploadAccountFaviconRequest
- type UploadAccountPhotoEndpoint
- type UploadAccountPhotoRequest
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AccountSvc ¶
type AccountSvc interface {
GetAccount(ctx context.Context, req *RetrieveAccountRequest) (*apiresource.Account, *apierror.APIError)
GetAccountBySlug(ctx context.Context, req *RetrieveAccountBySlugRequest) (*apiresource.PublicAccount, *apierror.APIError)
GetPortalProfileBySlug(ctx context.Context, req *RetrievePortalProfileRequest) (*apiresource.PortalProfile, *apierror.APIError)
UpdateAccount(ctx context.Context, req *UpdateAccountRequest) (*apiresource.Account, *apierror.APIError)
UploadAccountPhoto(ctx context.Context, req *UploadAccountPhotoRequest) (*apiresource.AccountPhotoUploadResult, *apierror.APIError)
GetAccountLogoURL(ctx context.Context, req *GetAccountLogoURLRequest) (*apiresource.AccountLogoURL, *apierror.APIError)
UploadAccountFavicon(ctx context.Context, req *UploadAccountFaviconRequest) (*apiresource.EmptyResource, *apierror.APIError)
GetAccountFaviconURL(ctx context.Context, req *GetAccountFaviconURLRequest) (*apiresource.AccountFaviconURL, *apierror.APIError)
}
func NewAccountSvc ¶
func NewAccountSvc(config *AccountSvcConfig) AccountSvc
type AccountSvcConfig ¶
type AccountSvcConfig struct {
// CoreClient (required) is the core-service gRPC client.
CoreClient pb.CoreServiceClient
}
type GetAccountFaviconURLEndpoint ¶
type GetAccountFaviconURLEndpoint struct{}
Returns a presigned download URL for the account's customer-portal favicon.
The URL expires one hour after it is generated, so fetch the favicon promptly rather than caching it. The response carries no URL when the account has never uploaded a favicon or the stored image is no longer available.
func (*GetAccountFaviconURLEndpoint) Materialize ¶
func (e *GetAccountFaviconURLEndpoint) Materialize() *apiendpoint.APIEndpoint[*GetAccountFaviconURLRequest, *apiresource.AccountFaviconURL]
type GetAccountFaviconURLRequest ¶
type GetAccountFaviconURLRequest struct {
// ID of the account whose favicon is being fetched.
AccountID string `path:"id" validate:"required"`
}
Request to get a presigned favicon URL.
type GetAccountLogoURLEndpoint ¶
type GetAccountLogoURLEndpoint struct{}
Returns a presigned download URL for the account's logo.
The URL expires one hour after it is generated, so fetch the logo promptly rather than caching it. The response carries no URL when the account has never uploaded a logo or the stored image is no longer available.
func (*GetAccountLogoURLEndpoint) Materialize ¶
func (e *GetAccountLogoURLEndpoint) Materialize() *apiendpoint.APIEndpoint[*GetAccountLogoURLRequest, *apiresource.AccountLogoURL]
type GetAccountLogoURLRequest ¶
type GetAccountLogoURLRequest struct {
// ID of the account whose logo is being fetched.
AccountID string `path:"id" validate:"required"`
}
Request to get a presigned logo URL.
type RetrieveAccountBySlugEndpoint ¶
type RetrieveAccountBySlugEndpoint struct{}
Returns a minimal public profile for the account that owns the given portal slug.
This endpoint does not require authentication; it is intended for customer portal branding lookups. The logo and favicon are returned as download URLs that stay valid for one hour.
func (*RetrieveAccountBySlugEndpoint) Materialize ¶
func (e *RetrieveAccountBySlugEndpoint) Materialize() *apiendpoint.APIEndpoint[*RetrieveAccountBySlugRequest, *apiresource.PublicAccount]
type RetrieveAccountBySlugRequest ¶
type RetrieveAccountBySlugRequest struct {
// Portal slug of the account to look up.
Slug string `path:"slug" validate:"required"`
}
Request to look up an account by portal slug.
type RetrieveAccountEndpoint ¶
type RetrieveAccountEndpoint struct{}
Returns an account by ID.
You can only retrieve the account you are acting in; requesting any other account is rejected.
func (*RetrieveAccountEndpoint) Materialize ¶
func (e *RetrieveAccountEndpoint) Materialize() *apiendpoint.APIEndpoint[*RetrieveAccountRequest, *apiresource.Account]
type RetrieveAccountRequest ¶
type RetrieveAccountRequest struct {
// ID of the account to retrieve.
AccountID string `path:"id" validate:"required"`
}
Request to retrieve an account by ID.
type RetrievePortalProfileEndpoint ¶
type RetrievePortalProfileEndpoint struct{}
Returns the seller portal profile for the given slug: the seller's identity and its public letterhead address.
Unlike the public branding lookup, this endpoint requires an authenticated caller. It is used by the logged-in customer portal (e.g. order documents) where the seller's letterhead address is shown.
func (*RetrievePortalProfileEndpoint) Materialize ¶
func (e *RetrievePortalProfileEndpoint) Materialize() *apiendpoint.APIEndpoint[*RetrievePortalProfileRequest, *apiresource.PortalProfile]
type RetrievePortalProfileRequest ¶
type RetrievePortalProfileRequest struct {
// Portal slug of the seller whose profile is being retrieved.
Slug string `path:"slug" validate:"required"`
}
Request to retrieve a seller's portal profile by slug.
type UpdateAccountEndpoint ¶
type UpdateAccountEndpoint struct{}
Partially updates an account's name, branding, and portal settings.
Only the fields provided in the request are changed. You can only update the account you are acting in. The logo and favicon are not set here; upload them through their own endpoints.
func (*UpdateAccountEndpoint) Materialize ¶
func (e *UpdateAccountEndpoint) Materialize() *apiendpoint.APIEndpoint[*UpdateAccountRequest, *apiresource.Account]
type UpdateAccountRequest ¶
type UpdateAccountRequest struct {
// ID of the account to update.
AccountID string `path:"id" validate:"required"`
// The account's display name.
Name field.Optional[string] `json:"name,omitzero" validate:"omitempty,max=255"`
// The email address customers are directed to for support.
SupportEmail field.Optional[string] `json:"support_email,omitzero" validate:"omitempty,custom_email,max=255"`
// The account's public contact phone number.
PhoneNumber field.Optional[string] `json:"phone_number,omitzero" validate:"omitempty,max=255"`
// URL slug for the account's customer portal.
//
// The slug is unique across all accounts; updating to one that is already taken returns a conflict error. Changing it changes the portal address customers use, so existing portal links stop resolving.
Slug field.Optional[string] `json:"slug,omitzero" validate:"omitempty,min=3,max=255"`
// The account's public website.
WebsiteURL field.Optional[string] `json:"website_url,omitzero" validate:"omitempty,url,max=2083"`
// Facebook handle.
FacebookHandle field.Optional[string] `json:"facebook_handle,omitzero" validate:"omitempty,max=255"`
// Instagram handle.
InstagramHandle field.Optional[string] `json:"instagram_handle,omitzero" validate:"omitempty,max=255"`
// LinkedIn handle.
LinkedInHandle field.Optional[string] `json:"linkedin_handle,omitzero" validate:"omitempty,max=255"`
// Twitter handle.
TwitterHandle field.Optional[string] `json:"twitter_handle,omitzero" validate:"omitempty,max=255"`
}
Request to partially update an account.
func (*UpdateAccountRequest) SchemaExample ¶
func (*UpdateAccountRequest) SchemaExample() any
type UploadAccountFaviconEndpoint ¶
type UploadAccountFaviconEndpoint struct{}
Uploads a customer-portal favicon.
Send the image as the raw request body, not as multipart form data. Use a small square PNG (e.g. 32x32 or 64x64) for the best result in browser tabs. The uploaded image replaces any existing favicon and is shown on the account's customer portal. You can only upload a favicon for the account you are acting in.
func (*UploadAccountFaviconEndpoint) Materialize ¶
func (e *UploadAccountFaviconEndpoint) Materialize() *apiendpoint.APIEndpoint[*UploadAccountFaviconRequest, *apiresource.EmptyResource]
type UploadAccountFaviconRequest ¶
type UploadAccountFaviconRequest struct {
// ID of the account the favicon belongs to.
AccountID string `path:"id" validate:"required"`
// Raw image bytes.
RawBody []byte `rawbody:"true"`
// Content type of the image (e.g., image/png).
//
// The image is stored as `image/png` if this header is omitted, so set it to match the actual format you upload.
ContentType string `header:"Content-Type"`
}
Request to upload a customer-portal favicon.
type UploadAccountPhotoEndpoint ¶
type UploadAccountPhotoEndpoint struct{}
Uploads an account logo.
Send the image as the raw request body, not as multipart form data. The uploaded image replaces any existing logo and can be retrieved via the Get Account Logo URL endpoint. You can only upload a logo for the account you are acting in.
func (*UploadAccountPhotoEndpoint) Materialize ¶
func (e *UploadAccountPhotoEndpoint) Materialize() *apiendpoint.APIEndpoint[*UploadAccountPhotoRequest, *apiresource.AccountPhotoUploadResult]
type UploadAccountPhotoRequest ¶
type UploadAccountPhotoRequest struct {
// ID of the account the logo belongs to.
AccountID string `path:"id" validate:"required"`
// Raw image bytes.
RawBody []byte `rawbody:"true"`
// Content type of the image (e.g., image/png).
//
// The image is stored as `image/png` if this header is omitted, so set it to match the actual format you upload.
ContentType string `header:"Content-Type"`
}
Request to upload an account logo.