размещения ручки

This commit is contained in:
Artem Tsyrulnikov
2026-01-20 20:15:18 +03:00
parent 33c9121571
commit e8ff317566
35 changed files with 949 additions and 290 deletions

View File

@@ -555,27 +555,36 @@ type PlacementDetails struct {
PlacementType *string `json:"placement_type,omitempty"`
Format *string `json:"format,omitempty"`
Comment *string `json:"comment,omitempty"`
CreativeID *string `json:"creative_id,omitempty"`
}
type PlacementOutput struct {
ID string `json:"id"`
Status string `json:"status"`
Comment *string `json:"comment,omitempty"`
InviteLink string `json:"invite_link"`
InviteLinkType string `json:"invite_link_type"`
Channel Channel `json:"channel"`
Details *PlacementDetails `json:"details,omitempty"`
PlacementPosts []PlacementPostOutput `json:"placement_posts,omitempty"`
ID string `json:"id"`
Status string `json:"status"`
CreativeID *string `json:"creative_id,omitempty"`
Comment *string `json:"comment,omitempty"`
InviteLink *string `json:"invite_link,omitempty"`
InviteLinkType string `json:"invite_link_type"`
Channel Channel `json:"channel"`
Details *PlacementDetails `json:"details,omitempty"`
PlacementPost *PlacementPostOutput `json:"placement_post,omitempty"`
}
type PlacementPostOutput struct {
ID string `json:"id"`
PlacementID string `json:"placement_id"`
Placement PlacementOutput `json:"placement"`
AdPostURL *string `json:"ad_post_url,omitempty"`
Status string `json:"status"`
SubscriptionsCount int `json:"subscriptions_count"`
CreatedAt string `json:"created_at"`
SubscriptionsCount int `json:"subscriptions_count"`
ViewsCount *int `json:"views_count,omitempty"`
CreatedAt string `json:"created_at"`
Post PostOutput `json:"post"`
}
type PostOutput struct {
ID string `json:"id"`
MessageID int `json:"message_id"`
Text string `json:"text"`
URL *string `json:"url,omitempty"`
DeletedFromChannelAt *string `json:"deleted_from_channel_at,omitempty"`
CreatedAt string `json:"created_at"`
UpdatedAt string `json:"updated_at"`
}
type CreatePlacementChannelInput struct {
@@ -586,7 +595,7 @@ type CreatePlacementChannelInput struct {
}
type CreatePlacementsInput struct {
CreativeID string `json:"creative_id"`
CreativeID *string `json:"creative_id,omitempty"`
Channels []CreatePlacementChannelInput `json:"channels"`
Details *PlacementDetails `json:"details,omitempty"`
}
@@ -595,6 +604,15 @@ type GetPlacementsOutput struct {
Placements []PlacementOutput `json:"placements"`
}
type CreativePreviewOutput struct {
ID string `json:"id"`
Name string `json:"name"`
Text string `json:"text"`
MediaType string `json:"media_type"`
MediaFileID string `json:"media_file_id"`
Buttons []CreativeButton `json:"buttons"`
}
func (c *Client) CreatePlacements(
ctx context.Context,
jwt string,
@@ -661,6 +679,33 @@ func (c *Client) GetPlacement(
return &placement, err
}
func (c *Client) BuildPlacementCreative(
ctx context.Context,
jwt string,
workspaceID string,
projectID string,
placementID string,
) (*CreativePreviewOutput, error) {
path := fmt.Sprintf(
"api/v1/workspaces/%s/projects/%s/placements/%s/creative",
workspaceID,
projectID,
placementID,
)
var resp CreativePreviewOutput
err := c.do(
ctx,
http.MethodPost,
path,
nil,
&resp,
withBearer(jwt),
)
return &resp, err
}
// ============================================================================
// Workspace Members
// ============================================================================