bingads

package
v0.2.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 23, 2024 License: MIT Imports: 12 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	EnvelopeNamespace = "http://schemas.xmlsoap.org/soap/envelope/"
	BingNamespace     = "https://bingads.microsoft.com/CampaignManagement/v13"
	AuthEndpoint      = "https://login.microsoftonline.com/common/oauth2/v2.0/authorize"
	TokenEndpoint     = "https://login.microsoftonline.com/common/oauth2/v2.0/token"
)

Functions

This section is empty.

Types

type AdApiError

type AdApiError struct {
	Code      int64  `xml:"AdApiError>Code"`
	Details   string `xml:"AdApiError>Details"`
	ErrorCode string `xml:"AdApiError>ErrorCode"`
	Message   string `xml:"AdApiError>Message"`
}

type BulkService

type BulkService struct {
	Endpoint string
	Session  *Session
}

func NewBulkService

func NewBulkService(session *Session) *BulkService

func (*BulkService) GetBulkUploadStatus

func (c *BulkService) GetBulkUploadStatus(requestId string) (*GetBulkUploadStatusResponse, error)

GetBulkUploadUrl

func (*BulkService) GetBulkUploadUrl

func (c *BulkService) GetBulkUploadUrl() (*GetBulkUploadUrlResponse, error)

GetBulkUploadUrl

func (*BulkService) UploadBulkFile

func (c *BulkService) UploadBulkFile(url, filename string) (*UploadBulkFileResponse, error)

type BulkServiceI

type BulkServiceI interface {
	GetBulkUploadUrl() (*GetBulkUploadUrlResponse, error)
	GetBulkUploadStatus(requestId string) (*GetBulkUploadStatusResponse, error)
	UploadBulkFile(url, filename string) (*UploadBulkFileResponse, error)
}

type ErrorsType

type ErrorsType struct {
	TrackingId      string           `xml:"TrackingId"`
	AdApiErrors     []AdApiError     `xml:"Errors"`
	OperationErrors []OperationError `xml:"OperationErrors"`
}

func (*ErrorsType) Error

func (f *ErrorsType) Error() string

type Fault

type Fault struct {
	FaultCode   string `xml:"faultcode"`
	FaultString string `xml:"faultstring"`
	Detail      struct {
		XMLName xml.Name   `xml:"detail"`
		Errors  ErrorsType `xml:",any"`
	}
}

type GetBulkUploadStatusRequest

type GetBulkUploadStatusRequest struct {
	XMLName   xml.Name `xml:"GetBulkUploadStatusRequest"`
	NS        string   `xml:"xmlns,attr"`
	RequestId string   `xml:"RequestId"`
}

type GetBulkUploadStatusResponse

type GetBulkUploadStatusResponse struct {
	XMLName         xml.Name   `xml:"GetBulkUploadStatusResponse"`
	NS              string     `xml:"xmlns,attr"`
	PercentComplete int64      `xml:"PercentComplete"`
	RequestStatus   string     `xml:"RequestStatus"`
	ResultFileUrl   string     `xml:"ResultFileUrl"`
	Errors          ErrorsType `xml:"ErrorsType"`
}

type GetBulkUploadUrlRequest

type GetBulkUploadUrlRequest struct {
	XMLName      xml.Name `xml:"GetBulkUploadUrlRequest"`
	NS           string   `xml:"xmlns,attr"`
	AccountId    int64    `xml:"AccountId"`
	ResponseMode string   `xml:"ResponseMode"`
}

type GetBulkUploadUrlResponse

type GetBulkUploadUrlResponse struct {
	UploadUrl string `xml:"UploadUrl"`
	RequestId string `xml:"RequestId"`
}

type HttpClient

type HttpClient interface {
	Do(*http.Request) (*http.Response, error)
}

type OperationError

type OperationError struct {
	Code      int64  `xml:"OperationError>Code"`
	Details   string `xml:"OperationError>Details"`
	ErrorCode string `xml:"OperationError>ErrorCode"`
	Message   string `xml:"OperationError>Message"`
}

type RequestBody

type RequestBody struct {
	XMLName xml.Name `xml:"s:Body"`
	Body    interface{}
}

type RequestEnvelope

type RequestEnvelope struct {
	XMLName xml.Name `xml:"s:Envelope"`
	EnvNS   string   `xml:"xmlns:i,attr"`
	EnvSS   string   `xml:"xmlns:s,attr"`
	Header  RequestHeader
	Body    RequestBody
}

type RequestHeader

type RequestHeader struct {
	XMLName             xml.Name `xml:"s:Header"`
	BingNS              string   `xml:"xmlns,attr"`
	Action              string
	AuthenticationToken string `xml:"AuthenticationToken,omitempty"`
	CustomerAccountId   string `xml:"CustomerAccountId"`
	CustomerId          string `xml:"CustomerId,omitempty"`
	DeveloperToken      string `xml:"DeveloperToken"`
	Password            string `xml:"Password,omitempty"`
	Username            string `xml:"UserName,omitempty"`
}

type Session

type Session struct {
	AccountId      string
	CustomerId     string
	DeveloperToken string
	Username       string
	Password       string
	HTTPClient     HttpClient
	TokenSource    oauth2.TokenSource
}

func NewSession

func NewSession(config SessionConfig) *Session

func (*Session) SendRequest

func (b *Session) SendRequest(body interface{}, endpoint, soapAction string) ([]byte, error)

type SessionConfig

type SessionConfig struct {
	OAuth2Config   *oauth2.Config
	OAuth2Token    *oauth2.Token
	AccountId      string
	CustomerId     string
	DeveloperToken string
	HTTPClient     HttpClient
	TokenSource    oauth2.TokenSource
}

type SoapResponseBody

type SoapResponseBody struct {
	OperationResponse []byte `xml:",innerxml"`
}

type SoapResponseEnvelope

type SoapResponseEnvelope struct {
	XMLName xml.Name         `xml:"http://schemas.xmlsoap.org/soap/envelope/ Envelope"`
	Header  TrackingId       `xml:"http://schemas.xmlsoap.org/soap/envelope/ Header"`
	Body    SoapResponseBody `xml:"http://schemas.xmlsoap.org/soap/envelope/ Body"`
}

type TrackingId

type TrackingId struct {
	Nil        bool   `xml:"http://www.w3.org/2001/XMLSchema-instance nil,attr"`
	TrackingId string `xml:"https://adcenter.microsoft.com/v8 TrackingId"`
}

type UploadBulkFileResponse

type UploadBulkFileResponse struct {
	TrackingId string `json:"TrackingId"`
	RequestId  string `json:"RequestId"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL