change domen
This commit is contained in:
@@ -141,12 +141,12 @@ type Workspace struct {
|
||||
}
|
||||
|
||||
type Project struct {
|
||||
ID string `json:"id"`
|
||||
TelegramID int64 `json:"telegram_id"`
|
||||
Title string `json:"title"`
|
||||
Username *string `json:"username"`
|
||||
Status string `json:"status"`
|
||||
InviteLinkType string `json:"invite_link_type"` // "public" или "approval"
|
||||
ID string `json:"id"`
|
||||
TelegramID int64 `json:"telegram_id"`
|
||||
Title string `json:"title"`
|
||||
Username *string `json:"username"`
|
||||
Status string `json:"status"`
|
||||
PurchaseInviteTypeDefault string `json:"purchase_invite_type_default"`
|
||||
}
|
||||
|
||||
type Page struct {
|
||||
@@ -231,7 +231,7 @@ func (c *Client) UpdateProjectInviteLinkType(
|
||||
path := fmt.Sprintf("api/v1/workspaces/%s/projects/%s/invite-link-type", workspaceID, projectID)
|
||||
|
||||
payload := map[string]string{
|
||||
"invite_link_type": inviteLinkType,
|
||||
"purchase_invite_type_default": inviteLinkType,
|
||||
}
|
||||
|
||||
var project Project
|
||||
@@ -306,13 +306,14 @@ func (c *Client) AcceptWorkspaceInvite(
|
||||
// ============================================================================
|
||||
|
||||
type Creative struct {
|
||||
ID string `json:"id"`
|
||||
ProjectID string `json:"project_id"`
|
||||
Name string `json:"name"`
|
||||
Text string `json:"text"`
|
||||
IsArchived bool `json:"is_archived"`
|
||||
CreatedAt string `json:"created_at"`
|
||||
UpdatedAt string `json:"updated_at"`
|
||||
ID string `json:"id"`
|
||||
Name string `json:"name"`
|
||||
Text string `json:"text"`
|
||||
ProjectID string `json:"project_id"`
|
||||
ProjectChannelTitle string `json:"project_channel_title"`
|
||||
CreatedAt string `json:"created_at"`
|
||||
Status string `json:"status"`
|
||||
PlacementsCount int `json:"placements_count"`
|
||||
}
|
||||
|
||||
type CreativesPage struct {
|
||||
@@ -406,9 +407,9 @@ func (c *Client) CreateCreative(
|
||||
}
|
||||
|
||||
type UpdateCreativeInput struct {
|
||||
Name *string `json:"name,omitempty"`
|
||||
Text *string `json:"text,omitempty"`
|
||||
IsArchived *bool `json:"is_archived,omitempty"`
|
||||
Name *string `json:"name,omitempty"`
|
||||
Text *string `json:"text,omitempty"`
|
||||
Status *string `json:"status,omitempty"`
|
||||
}
|
||||
|
||||
func (c *Client) UpdateCreative(
|
||||
@@ -456,17 +457,24 @@ func (c *Client) DeleteCreative(
|
||||
// ============================================================================
|
||||
|
||||
type Placement struct {
|
||||
ID string `json:"id"`
|
||||
ProjectID string `json:"project_id"`
|
||||
PlacementChannelID string `json:"placement_channel_id"`
|
||||
CreativeID *string `json:"creative_id"`
|
||||
Name string `json:"name"`
|
||||
Price *int `json:"price"`
|
||||
Status string `json:"status"`
|
||||
InviteLink *string `json:"invite_link"`
|
||||
IsArchived bool `json:"is_archived"`
|
||||
CreatedAt string `json:"created_at"`
|
||||
UpdatedAt string `json:"updated_at"`
|
||||
ID string `json:"id"`
|
||||
ProjectID string `json:"project_id"`
|
||||
ProjectChannelTitle *string `json:"project_channel_title"`
|
||||
PlacementChannelID string `json:"placement_channel_id"`
|
||||
PlacementChannelTitle *string `json:"placement_channel_title"`
|
||||
CreativeID string `json:"creative_id"`
|
||||
CreativeName string `json:"creative_name"`
|
||||
PlacementDate string `json:"placement_date"`
|
||||
Cost *float64 `json:"cost"`
|
||||
Comment *string `json:"comment"`
|
||||
AdPostURL *string `json:"ad_post_url"`
|
||||
InviteLinkType string `json:"invite_link_type"`
|
||||
InviteLink string `json:"invite_link"`
|
||||
Status string `json:"status"`
|
||||
SubscriptionsCount int `json:"subscriptions_count"`
|
||||
PurchaseID *string `json:"purchase_id"`
|
||||
PurchaseChannelID *string `json:"purchase_channel_id"`
|
||||
CreatedAt string `json:"created_at"`
|
||||
}
|
||||
|
||||
type PlacementsPage struct {
|
||||
@@ -537,84 +545,10 @@ func (c *Client) GetPlacement(
|
||||
return &placement, err
|
||||
}
|
||||
|
||||
type CreatePlacementInput struct {
|
||||
ProjectID string `json:"project_id"`
|
||||
PlacementChannelID string `json:"placement_channel_id"`
|
||||
CreativeID *string `json:"creative_id,omitempty"`
|
||||
Name string `json:"name"`
|
||||
Price *int `json:"price,omitempty"`
|
||||
}
|
||||
|
||||
func (c *Client) CreatePlacement(
|
||||
ctx context.Context,
|
||||
jwt string,
|
||||
workspaceID string,
|
||||
input CreatePlacementInput,
|
||||
) (*Placement, error) {
|
||||
path := fmt.Sprintf("api/v1/workspaces/%s/placements", workspaceID)
|
||||
|
||||
var placement Placement
|
||||
err := c.do(
|
||||
ctx,
|
||||
http.MethodPost,
|
||||
path,
|
||||
input,
|
||||
&placement,
|
||||
withBearer(jwt),
|
||||
)
|
||||
|
||||
return &placement, err
|
||||
}
|
||||
|
||||
type UpdatePlacementInput struct {
|
||||
Name *string `json:"name,omitempty"`
|
||||
Price *int `json:"price,omitempty"`
|
||||
Status *string `json:"status,omitempty"`
|
||||
IsArchived *bool `json:"is_archived,omitempty"`
|
||||
}
|
||||
|
||||
func (c *Client) UpdatePlacement(
|
||||
ctx context.Context,
|
||||
jwt string,
|
||||
workspaceID string,
|
||||
placementID string,
|
||||
input UpdatePlacementInput,
|
||||
) (*Placement, error) {
|
||||
path := fmt.Sprintf("api/v1/workspaces/%s/placements/%s", workspaceID, placementID)
|
||||
|
||||
var placement Placement
|
||||
err := c.do(
|
||||
ctx,
|
||||
http.MethodPatch,
|
||||
path,
|
||||
input,
|
||||
&placement,
|
||||
withBearer(jwt),
|
||||
)
|
||||
|
||||
return &placement, err
|
||||
}
|
||||
|
||||
func (c *Client) DeletePlacement(
|
||||
ctx context.Context,
|
||||
jwt string,
|
||||
workspaceID string,
|
||||
placementID string,
|
||||
) error {
|
||||
path := fmt.Sprintf("api/v1/workspaces/%s/placements/%s", workspaceID, placementID)
|
||||
|
||||
return c.do(
|
||||
ctx,
|
||||
http.MethodDelete,
|
||||
path,
|
||||
nil,
|
||||
nil,
|
||||
withBearer(jwt),
|
||||
)
|
||||
}
|
||||
// Note: Placement creation/updates are handled by worker; API exposes only read endpoints.
|
||||
|
||||
// ============================================================================
|
||||
// Purchase Plan
|
||||
// Purchases (Закупы)
|
||||
// ============================================================================
|
||||
|
||||
type Channel struct {
|
||||
@@ -624,24 +558,67 @@ type Channel struct {
|
||||
Username *string `json:"username"`
|
||||
}
|
||||
|
||||
type PurchasePlanChannel struct {
|
||||
ID string `json:"id"`
|
||||
Channel Channel `json:"channel"`
|
||||
Status string `json:"status"`
|
||||
PlannedCost *float64 `json:"planned_cost"`
|
||||
Comment *string `json:"comment"`
|
||||
type Purchase struct {
|
||||
ID string `json:"id"`
|
||||
Status string `json:"status"`
|
||||
CreativeID string `json:"creative_id"`
|
||||
Channels []PurchaseChannelOut `json:"channels"`
|
||||
}
|
||||
|
||||
func (c *Client) GetPurchasePlanChannels(
|
||||
type PurchaseChannelOut struct {
|
||||
ID string `json:"id"`
|
||||
Status string `json:"status"`
|
||||
PlannedCost *float64 `json:"planned_cost"`
|
||||
Comment *string `json:"comment"`
|
||||
InviteLink string `json:"invite_link"`
|
||||
InviteLinkType string `json:"invite_link_type"`
|
||||
Channel Channel `json:"channel"`
|
||||
}
|
||||
|
||||
type CreatePurchaseChannelInput struct {
|
||||
Username string `json:"username"`
|
||||
Status *string `json:"status,omitempty"`
|
||||
PlannedCost *float64 `json:"planned_cost,omitempty"`
|
||||
Comment *string `json:"comment,omitempty"`
|
||||
}
|
||||
|
||||
type CreatePurchaseInput struct {
|
||||
CreativeID string `json:"creative_id"`
|
||||
Channels []CreatePurchaseChannelInput `json:"channels"`
|
||||
}
|
||||
|
||||
func (c *Client) CreatePurchase(
|
||||
ctx context.Context,
|
||||
jwt string,
|
||||
workspaceID string,
|
||||
projectID string,
|
||||
) ([]PurchasePlanChannel, error) {
|
||||
path := fmt.Sprintf("api/v1/workspaces/%s/projects/%s/purchase-plan/channels", workspaceID, projectID)
|
||||
input CreatePurchaseInput,
|
||||
) (*Purchase, error) {
|
||||
path := fmt.Sprintf("api/v1/workspaces/%s/projects/%s/purchase", workspaceID, projectID)
|
||||
|
||||
var purchase Purchase
|
||||
err := c.do(
|
||||
ctx,
|
||||
http.MethodPost,
|
||||
path,
|
||||
input,
|
||||
&purchase,
|
||||
withBearer(jwt),
|
||||
)
|
||||
|
||||
return &purchase, err
|
||||
}
|
||||
|
||||
func (c *Client) GetPurchases(
|
||||
ctx context.Context,
|
||||
jwt string,
|
||||
workspaceID string,
|
||||
projectID string,
|
||||
) ([]Purchase, error) {
|
||||
path := fmt.Sprintf("api/v1/workspaces/%s/projects/%s/purchase", workspaceID, projectID)
|
||||
|
||||
var resp struct {
|
||||
Items []PurchasePlanChannel `json:"items"`
|
||||
Items []Purchase `json:"items"`
|
||||
}
|
||||
|
||||
err := c.do(
|
||||
@@ -656,81 +633,26 @@ func (c *Client) GetPurchasePlanChannels(
|
||||
return resp.Items, err
|
||||
}
|
||||
|
||||
type AttachChannelToPurchasePlanInput struct {
|
||||
Username string `json:"username"`
|
||||
Status *string `json:"status,omitempty"`
|
||||
PlannedCost *float64 `json:"planned_cost,omitempty"`
|
||||
Comment *string `json:"comment,omitempty"`
|
||||
}
|
||||
|
||||
func (c *Client) AttachChannelToPurchasePlan(
|
||||
func (c *Client) GetPurchase(
|
||||
ctx context.Context,
|
||||
jwt string,
|
||||
workspaceID string,
|
||||
projectID string,
|
||||
input AttachChannelToPurchasePlanInput,
|
||||
) (*PurchasePlanChannel, error) {
|
||||
path := fmt.Sprintf("api/v1/workspaces/%s/projects/%s/purchase-plan/channels", workspaceID, projectID)
|
||||
purchaseID string,
|
||||
) (*Purchase, error) {
|
||||
path := fmt.Sprintf("api/v1/workspaces/%s/projects/%s/purchase/%s", workspaceID, projectID, purchaseID)
|
||||
|
||||
var planChannel PurchasePlanChannel
|
||||
var purchase Purchase
|
||||
err := c.do(
|
||||
ctx,
|
||||
http.MethodPost,
|
||||
path,
|
||||
input,
|
||||
&planChannel,
|
||||
withBearer(jwt),
|
||||
)
|
||||
|
||||
return &planChannel, err
|
||||
}
|
||||
|
||||
type UpdatePurchasePlanChannelInput struct {
|
||||
Status *string `json:"status,omitempty"`
|
||||
PlannedCost *float64 `json:"planned_cost,omitempty"`
|
||||
Comment *string `json:"comment,omitempty"`
|
||||
}
|
||||
|
||||
func (c *Client) UpdatePurchasePlanChannel(
|
||||
ctx context.Context,
|
||||
jwt string,
|
||||
workspaceID string,
|
||||
projectID string,
|
||||
channelID string,
|
||||
input UpdatePurchasePlanChannelInput,
|
||||
) (*PurchasePlanChannel, error) {
|
||||
path := fmt.Sprintf("api/v1/workspaces/%s/projects/%s/purchase-plan/channels/%s", workspaceID, projectID, channelID)
|
||||
|
||||
var planChannel PurchasePlanChannel
|
||||
err := c.do(
|
||||
ctx,
|
||||
http.MethodPatch,
|
||||
path,
|
||||
input,
|
||||
&planChannel,
|
||||
withBearer(jwt),
|
||||
)
|
||||
|
||||
return &planChannel, err
|
||||
}
|
||||
|
||||
func (c *Client) RemoveChannelFromPurchasePlan(
|
||||
ctx context.Context,
|
||||
jwt string,
|
||||
workspaceID string,
|
||||
projectID string,
|
||||
channelID string,
|
||||
) error {
|
||||
path := fmt.Sprintf("api/v1/workspaces/%s/projects/%s/purchase-plan/channels/%s", workspaceID, projectID, channelID)
|
||||
|
||||
return c.do(
|
||||
ctx,
|
||||
http.MethodDelete,
|
||||
http.MethodGet,
|
||||
path,
|
||||
nil,
|
||||
nil,
|
||||
&purchase,
|
||||
withBearer(jwt),
|
||||
)
|
||||
|
||||
return &purchase, err
|
||||
}
|
||||
|
||||
// ============================================================================
|
||||
|
||||
Reference in New Issue
Block a user