Skip to content

Latest commit

 

History

History
428 lines (270 loc) · 10.8 KB

File metadata and controls

428 lines (270 loc) · 10.8 KB

\CampaignsAPI

All URIs are relative to https://api.elasticemail.com/v4

Method HTTP request Description
CampaignsByNameDelete Delete /campaigns/{name} Delete Campaign
CampaignsByNameGet Get /campaigns/{name} Load Campaign
CampaignsByNamePausePut Put /campaigns/{name}/pause Pause Campaign
CampaignsByNamePut Put /campaigns/{name} Update Campaign
CampaignsGet Get /campaigns Load Campaigns
CampaignsPost Post /campaigns Add Campaign

CampaignsByNameDelete

CampaignsByNameDelete(ctx, name).Execute()

Delete Campaign

Example

package main

import (
	"context"
	"fmt"
	"os"
	openapiclient "github.com/elasticemail/elasticemail-go"
)

func main() {
	name := "name_example" // string | Name of Campaign to delete

	configuration := openapiclient.NewConfiguration()
	apiClient := openapiclient.NewAPIClient(configuration)
	r, err := apiClient.CampaignsAPI.CampaignsByNameDelete(context.Background(), name).Execute()
	if err != nil {
		fmt.Fprintf(os.Stderr, "Error when calling `CampaignsAPI.CampaignsByNameDelete``: %v\n", err)
		fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
	}
}

Path Parameters

Name Type Description Notes
ctx context.Context context for authentication, logging, cancellation, deadlines, tracing, etc.
name string Name of Campaign to delete

Other Parameters

Other parameters are passed through a pointer to a apiCampaignsByNameDeleteRequest struct via the builder pattern

Name Type Description Notes

Return type

(empty response body)

Authorization

apikey

HTTP request headers

  • Content-Type: Not defined
  • Accept: Not defined

[Back to top] [Back to API list] [Back to Model list] [Back to README]

CampaignsByNameGet

Campaign CampaignsByNameGet(ctx, name).Execute()

Load Campaign

Example

package main

import (
	"context"
	"fmt"
	"os"
	openapiclient "github.com/elasticemail/elasticemail-go"
)

func main() {
	name := "name_example" // string | Name of Campaign to get

	configuration := openapiclient.NewConfiguration()
	apiClient := openapiclient.NewAPIClient(configuration)
	resp, r, err := apiClient.CampaignsAPI.CampaignsByNameGet(context.Background(), name).Execute()
	if err != nil {
		fmt.Fprintf(os.Stderr, "Error when calling `CampaignsAPI.CampaignsByNameGet``: %v\n", err)
		fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
	}
	// response from `CampaignsByNameGet`: Campaign
	fmt.Fprintf(os.Stdout, "Response from `CampaignsAPI.CampaignsByNameGet`: %v\n", resp)
}

Path Parameters

Name Type Description Notes
ctx context.Context context for authentication, logging, cancellation, deadlines, tracing, etc.
name string Name of Campaign to get

Other Parameters

Other parameters are passed through a pointer to a apiCampaignsByNameGetRequest struct via the builder pattern

Name Type Description Notes

Return type

Campaign

Authorization

apikey

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

CampaignsByNamePausePut

CampaignsByNamePausePut(ctx, name).Execute()

Pause Campaign

Example

package main

import (
	"context"
	"fmt"
	"os"
	openapiclient "github.com/elasticemail/elasticemail-go"
)

func main() {
	name := "name_example" // string | Name of Campaign to pause

	configuration := openapiclient.NewConfiguration()
	apiClient := openapiclient.NewAPIClient(configuration)
	r, err := apiClient.CampaignsAPI.CampaignsByNamePausePut(context.Background(), name).Execute()
	if err != nil {
		fmt.Fprintf(os.Stderr, "Error when calling `CampaignsAPI.CampaignsByNamePausePut``: %v\n", err)
		fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
	}
}

Path Parameters

Name Type Description Notes
ctx context.Context context for authentication, logging, cancellation, deadlines, tracing, etc.
name string Name of Campaign to pause

Other Parameters

Other parameters are passed through a pointer to a apiCampaignsByNamePausePutRequest struct via the builder pattern

Name Type Description Notes

Return type

(empty response body)

Authorization

apikey

HTTP request headers

  • Content-Type: Not defined
  • Accept: Not defined

[Back to top] [Back to API list] [Back to Model list] [Back to README]

CampaignsByNamePut

Campaign CampaignsByNamePut(ctx, name).Campaign(campaign).Execute()

Update Campaign

Example

package main

import (
	"context"
	"fmt"
	"os"
	openapiclient "github.com/elasticemail/elasticemail-go"
)

func main() {
	name := "name_example" // string | Name of Campaign to update
	campaign := *openapiclient.NewCampaign("Name_example", *openapiclient.NewCampaignRecipient()) // Campaign | JSON representation of a campaign

	configuration := openapiclient.NewConfiguration()
	apiClient := openapiclient.NewAPIClient(configuration)
	resp, r, err := apiClient.CampaignsAPI.CampaignsByNamePut(context.Background(), name).Campaign(campaign).Execute()
	if err != nil {
		fmt.Fprintf(os.Stderr, "Error when calling `CampaignsAPI.CampaignsByNamePut``: %v\n", err)
		fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
	}
	// response from `CampaignsByNamePut`: Campaign
	fmt.Fprintf(os.Stdout, "Response from `CampaignsAPI.CampaignsByNamePut`: %v\n", resp)
}

Path Parameters

Name Type Description Notes
ctx context.Context context for authentication, logging, cancellation, deadlines, tracing, etc.
name string Name of Campaign to update

Other Parameters

Other parameters are passed through a pointer to a apiCampaignsByNamePutRequest struct via the builder pattern

Name Type Description Notes

campaign | Campaign | JSON representation of a campaign |

Return type

Campaign

Authorization

apikey

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

CampaignsGet

[]Campaign CampaignsGet(ctx).Search(search).Offset(offset).Limit(limit).Execute()

Load Campaigns

Example

package main

import (
	"context"
	"fmt"
	"os"
	openapiclient "github.com/elasticemail/elasticemail-go"
)

func main() {
	search := "search_example" // string | Text fragment used for searching in Campaign name (using the 'contains' rule) (optional)
	offset := int32(20) // int32 | How many items should be returned ahead. (optional)
	limit := int32(100) // int32 | Maximum number of returned items. (optional)

	configuration := openapiclient.NewConfiguration()
	apiClient := openapiclient.NewAPIClient(configuration)
	resp, r, err := apiClient.CampaignsAPI.CampaignsGet(context.Background()).Search(search).Offset(offset).Limit(limit).Execute()
	if err != nil {
		fmt.Fprintf(os.Stderr, "Error when calling `CampaignsAPI.CampaignsGet``: %v\n", err)
		fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
	}
	// response from `CampaignsGet`: []Campaign
	fmt.Fprintf(os.Stdout, "Response from `CampaignsAPI.CampaignsGet`: %v\n", resp)
}

Path Parameters

Other Parameters

Other parameters are passed through a pointer to a apiCampaignsGetRequest struct via the builder pattern

Name Type Description Notes
search string Text fragment used for searching in Campaign name (using the 'contains' rule)
offset int32 How many items should be returned ahead.
limit int32 Maximum number of returned items.

Return type

[]Campaign

Authorization

apikey

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

CampaignsPost

Campaign CampaignsPost(ctx).Campaign(campaign).Execute()

Add Campaign

Example

package main

import (
	"context"
	"fmt"
	"os"
	openapiclient "github.com/elasticemail/elasticemail-go"
)

func main() {
	campaign := *openapiclient.NewCampaign("Name_example", *openapiclient.NewCampaignRecipient()) // Campaign | JSON representation of a campaign

	configuration := openapiclient.NewConfiguration()
	apiClient := openapiclient.NewAPIClient(configuration)
	resp, r, err := apiClient.CampaignsAPI.CampaignsPost(context.Background()).Campaign(campaign).Execute()
	if err != nil {
		fmt.Fprintf(os.Stderr, "Error when calling `CampaignsAPI.CampaignsPost``: %v\n", err)
		fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
	}
	// response from `CampaignsPost`: Campaign
	fmt.Fprintf(os.Stdout, "Response from `CampaignsAPI.CampaignsPost`: %v\n", resp)
}

Path Parameters

Other Parameters

Other parameters are passed through a pointer to a apiCampaignsPostRequest struct via the builder pattern

Name Type Description Notes
campaign Campaign JSON representation of a campaign

Return type

Campaign

Authorization

apikey

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]