Skip to content

Latest commit

 

History

History
554 lines (399 loc) · 10.4 KB

example-endpoints.md

File metadata and controls

554 lines (399 loc) · 10.4 KB

Table of Content

fetch event logs

package main

import(
	"pepipost_lib/pepipost_pkg"
	"time"
	"encoding/json"
	"pepipost_lib/configuration_pkg"
	"pepipost_lib/models_pkg"
)

func main(){
    ApiKey := "your api_key here"
    
    client := PepipostClient.NewPEPIPOSTCLIENT(ApiKey)
    
    events := client.Events()
    
    Startdate := "2016-03-13T12:52:32.123Z"
    Events := models_pkg.Events_SENT
    Sort := models_pkg.Sort_ASC
    Offset := int64(111)
    Limit := int64(1)
    Subject := "test"
    Email := "[email protected]"
    
    var err error
    var result interface{}
    result, err = events.GetEventsGET(Startdate, Events, Sort, nil, Offset, Limit, Subject, nil, nil, Email)
    
    if err != nil{
        //TODO: Use err variable here
    }else{
        //TODO: Use result variable here
        println(result)
    }
    
    

}

fetch summary stats

package main

import(
	"pepipost_lib/pepipost_pkg"
	"time"
	"encoding/json"
	"pepipost_lib/configuration_pkg"
	"pepipost_lib/models_pkg"
)

func main(){
    ApiKey := "your api_key here"
    
    client := PepipostClient.NewPEPIPOSTCLIENT(ApiKey)
    
    stats := client.Stats()
    
    Startdate := "2016-03-13T12:52:32.123Z"
    AggregatedBy := models_pkg.AggregatedBy_MONTH
    Offset := int64(111)
    Limit := int64(1)
    
    var err error
    var result interface{}
    result, err = stats.GetStatsGET(Startdate, nil, AggregatedBy, Offset, Limit)
    
    if err != nil{
        //TODO: Use err variable here
    }else{
        //TODO: Use result variable here
        println(result)
    }
    
    

}

Domain Add

package main

import(
	"pepipost_lib/pepipost_pkg"
	"time"
	"encoding/json"
	"pepipost_lib/configuration_pkg"
	"pepipost_lib/models_pkg"
)

func main(){
    ApiKey := "your api_key here"
    
    client := PepipostClient.NewPEPIPOSTCLIENT(ApiKey)
    
    domain := client.Domain()
    
    Body := &models_pkg.DomainStruct{}
    Body.Domain = "example.com"
    Body.EnvelopeName = "test"
    
    var err error
    var result interface{}
    result, err = domain.AddDomain(Body)
    
    if err != nil{
        //TODO: Use err variable here
    }else{
        //TODO: Use result variable here
        println(result)
    }
    
    

}

Domain delete

package main

import(
	"pepipost_lib/pepipost_pkg"
	"time"
	"encoding/json"
	"pepipost_lib/configuration_pkg"
	"pepipost_lib/models_pkg"
)

func main(){
    ApiKey := "your api_key here"
    
    client := PepipostClient.NewPEPIPOSTCLIENT(ApiKey)
    
    domainDelete := client.DomainDelete()
    
    Body := &models_pkg.DeleteDomain{}
    Body.Domain = "example.com"
    
    var err error
    var result interface{}
    result, err = domainDelete.DeleteDomain(Body)
    
    if err != nil{
        //TODO: Use err variable here
    }else{
        //TODO: Use result variable here
        println(result)
    }
    
    

}

Suppression add

package main

import(
	"pepipost_lib/pepipost_pkg"
	"time"
	"encoding/json"
	"pepipost_lib/configuration_pkg"
	"pepipost_lib/models_pkg"
)

func main(){
    ApiKey := "your api_key here"
    
    client := PepipostClient.NewPEPIPOSTCLIENT(ApiKey)
    
    suppression := client.Suppression()
    
    Body := &models_pkg.AddEmailOrDomainToSuppressionList{}
    Body.Domain = "example.com"
    Body.Email = "[email protected]"
    
    var err error
    var result interface{}
    result, err = suppression.AddDomainOrEmailToSuppressionList(Body)
    
    if err != nil{
        //TODO: Use err variable here
    }else{
        //TODO: Use result variable here
        println(result)
    }
    
    

}

Suppression delete

package main

import(
	"pepipost_lib/pepipost_pkg"
	"time"
	"encoding/json"
	"pepipost_lib/configuration_pkg"
	"pepipost_lib/models_pkg"
)

func main(){
    ApiKey := "your api_key here"
    
    client := PepipostClient.NewPEPIPOSTCLIENT(ApiKey)
    
    suppression := client.Suppression()
    
    Body := &models_pkg.RemoveEmailOrDomainToSuppressionList{}
    Body.Domain = "example.com"
    Body.Email = "[email protected]"
    
    var err error
    var result interface{}
    result, err = suppression.RemoveDomainOrEmailToSuppressionList(Body)
    
    if err != nil{
        //TODO: Use err variable here
    }else{
        //TODO: Use result variable here
        println(result)
    }
    
    

}

create subaccount

package main

import(
	"pepipost_lib/pepipost_pkg"
	"time"
	"encoding/json"
	"pepipost_lib/configuration_pkg"
	"pepipost_lib/models_pkg"
)

func main(){
    ApiKey := "your api_key here"
    
    client := PepipostClient.NewPEPIPOSTCLIENT(ApiKey)
    
    subaccountsCreateSubaccount := client.SubaccountsCreateSubaccount()
    
    Body := &models_pkg.CreateSubaccount{}
    Body.Username = "name"
    Body.Email = "email1.gmail.com"
    Body.Setpassword = "setpassword8"
    Body.Password = "pwd"
    
    var err error
    var result interface{}
    result, err = subaccountsCreateSubaccount.CreateSubaccountsCreateSubaccountPOST(Body)
    
    if err != nil{
        //TODO: Use err variable here
    }else{
        //TODO: Use result variable here
        println(result)
    }
    
    

}

update subaccount

package main

import(
	"pepipost_lib/pepipost_pkg"
	"time"
	"encoding/json"
	"pepipost_lib/configuration_pkg"
	"pepipost_lib/models_pkg"
)

func main(){
    ApiKey := "your api_key here"
    
    client := PepipostClient.NewPEPIPOSTCLIENT(ApiKey)
    
    subaccountsUpdateSubaccount := client.SubaccountsUpdateSubaccount()
    
    Body := &models_pkg.UpdateSubaccount{}
    Body.Username = "username"
    Body.NewEmail = "[email protected]"
    Body.NewPassword = "pwd"
    Body.ConfirmPassword = "pwd"
    
    var err error
    var result interface{}
    result, err = subaccountsUpdateSubaccount.CreateSubaccountsUpdateSubaccountPOST(Body)
    
    if err != nil{
        //TODO: Use err variable here
    }else{
        //TODO: Use result variable here
        println(result)
    }
    
    

}

enable/disable subaccount

package main

import(
	"pepipost_lib/pepipost_pkg"
	"time"
	"encoding/json"
	"pepipost_lib/configuration_pkg"
	"pepipost_lib/models_pkg"
)

func main(){
    ApiKey := "your api_key here"
    
    client := PepipostClient.NewPEPIPOSTCLIENT(ApiKey)
    
    subaccounts := client.Subaccounts()
    
    Body := &models_pkg.EnableOrDisableSubacoount{}
    Body.Username = "username"
    Body.Disabled = true
    
    var err error
    var result interface{}
    result, err = subaccounts.UpdateSubaccountsPATCH(Body)
    
    if err != nil{
        //TODO: Use err variable here
    }else{
        //TODO: Use result variable here
        println(result)
    }
    
    

}

delete subaccount

package main

import(
	"pepipost_lib/pepipost_pkg"
	"time"
	"encoding/json"
	"pepipost_lib/configuration_pkg"
	"pepipost_lib/models_pkg"
)

func main(){
    ApiKey := "your api_key here"
    
    client := PepipostClient.NewPEPIPOSTCLIENT(ApiKey)
    
    subaccountsDelete := client.SubaccountsDelete()
    
    Body := &models_pkg.DeleteSubacoount{}
    Body.Username = "username"
    
    var err error
    var result interface{}
    result, err = subaccountsDelete.DeleteSubaccountsDeleteDELETE(Body)
    
    if err != nil{
        //TODO: Use err variable here
    }else{
        //TODO: Use result variable here
        println(result)
    }
    
    

}

set recurring credit in subaccount

package main

import(
	"pepipost_lib/pepipost_pkg"
	"time"
	"encoding/json"
	"pepipost_lib/configuration_pkg"
	"pepipost_lib/models_pkg"
)

func main(){
    ApiKey := "your api_key here"
    
    client := PepipostClient.NewPEPIPOSTCLIENT(ApiKey)
    
    setrecurringcreditddetails := client.Setrecurringcreditddetails()
    
    Body := &models_pkg.UpdateRecurringCredisOfSubaccount{}
    Body.Username = "username"
    Body.RecurringCredit = int64(100)
    Body.Timeperiod = models_pkg.Timeperiod_WEEKLY
    
    var err error
    var result interface{}
    result, err = setrecurringcreditddetails.CreateSetrecurringcreditddetailsPOST(Body)
    
    if err != nil{
        //TODO: Use err variable here
    }else{
        //TODO: Use result variable here
        println(result)
    }
    
    

}

add credit in subaccount

package main

import(
	"pepipost_lib/pepipost_pkg"
	"time"
	"encoding/json"
	"pepipost_lib/configuration_pkg"
	"pepipost_lib/models_pkg"
)

func main(){
    ApiKey := "your api_key here"
    
    client := PepipostClient.NewPEPIPOSTCLIENT(ApiKey)
    
    subaccountsSetsubaccountcredit := client.SubaccountsSetsubaccountcredit()
    
    Body := &models_pkg.UpdateCredisOfSubaccount{}
    Body.Username = "username"
    Body.Action = models_pkg.Action_DECREASE
    Body.Amount = int64(100)
    
    var err error
    var result interface{}
    result, err = subaccountsSetsubaccountcredit.CreateSubaccountsSetsubaccountcreditPOST(Body)
    
    if err != nil{
        //TODO: Use err variable here
    }else{
        //TODO: Use result variable here
        println(result)
    }
    
    

}

get credit details of subaccount

package main

import(
	"pepipost_lib/pepipost_pkg"
	"time"
	"encoding/json"
	"pepipost_lib/configuration_pkg"
	"pepipost_lib/models_pkg"
)

func main(){
    ApiKey := "your api_key here"
    
    client := PepipostClient.NewPEPIPOSTCLIENT(ApiKey)
    
    subaccountsGetSubAccounts := client.SubaccountsGetSubAccounts()
    
    Limit := "100"
    Offset := "1"
    
    var err error
    var result interface{}
    result, err = subaccountsGetSubAccounts.GetSubaccountsGetSubAccountsGET(Limit, Offset)
    
    if err != nil{
        //TODO: Use err variable here
    }else{
        //TODO: Use result variable here
        println(result)
    }
    
    

}