github.com/twilio/twilio-go@v1.20.1/rest/trusthub/v1/compliance_inquiries_customers_initialize.go (about)

     1  /*
     2   * This code was generated by
     3   * ___ _ _ _ _ _    _ ____    ____ ____ _    ____ ____ _  _ ____ ____ ____ ___ __   __
     4   *  |  | | | | |    | |  | __ |  | |__| | __ | __ |___ |\ | |___ |__/ |__|  | |  | |__/
     5   *  |  |_|_| | |___ | |__|    |__| |  | |    |__] |___ | \| |___ |  \ |  |  | |__| |  \
     6   *
     7   * Twilio - Trusthub
     8   * This is the public Twilio REST API.
     9   *
    10   * NOTE: This class is auto generated by OpenAPI Generator.
    11   * https://openapi-generator.tech
    12   * Do not edit the class manually.
    13   */
    14  
    15  package openapi
    16  
    17  import (
    18  	"encoding/json"
    19  	"net/url"
    20  	"strings"
    21  )
    22  
    23  // Optional parameters for the method 'CreateComplianceInquiry'
    24  type CreateComplianceInquiryParams struct {
    25  	// The unique SID identifier of the Primary Customer Profile that should be used as a parent. Only necessary when creating a secondary Customer Profile.
    26  	PrimaryProfileSid *string `json:"PrimaryProfileSid,omitempty"`
    27  	// The email address that approval status updates will be sent to. If not specified, the email address associated with your primary customer profile will be used.
    28  	NotificationEmail *string `json:"NotificationEmail,omitempty"`
    29  }
    30  
    31  func (params *CreateComplianceInquiryParams) SetPrimaryProfileSid(PrimaryProfileSid string) *CreateComplianceInquiryParams {
    32  	params.PrimaryProfileSid = &PrimaryProfileSid
    33  	return params
    34  }
    35  func (params *CreateComplianceInquiryParams) SetNotificationEmail(NotificationEmail string) *CreateComplianceInquiryParams {
    36  	params.NotificationEmail = &NotificationEmail
    37  	return params
    38  }
    39  
    40  // Create a new Compliance Inquiry for the authenticated account. This is necessary to start a new embedded session.
    41  func (c *ApiService) CreateComplianceInquiry(params *CreateComplianceInquiryParams) (*TrusthubV1ComplianceInquiry, error) {
    42  	path := "/v1/ComplianceInquiries/Customers/Initialize"
    43  
    44  	data := url.Values{}
    45  	headers := make(map[string]interface{})
    46  
    47  	if params != nil && params.PrimaryProfileSid != nil {
    48  		data.Set("PrimaryProfileSid", *params.PrimaryProfileSid)
    49  	}
    50  	if params != nil && params.NotificationEmail != nil {
    51  		data.Set("NotificationEmail", *params.NotificationEmail)
    52  	}
    53  
    54  	resp, err := c.requestHandler.Post(c.baseURL+path, data, headers)
    55  	if err != nil {
    56  		return nil, err
    57  	}
    58  
    59  	defer resp.Body.Close()
    60  
    61  	ps := &TrusthubV1ComplianceInquiry{}
    62  	if err := json.NewDecoder(resp.Body).Decode(ps); err != nil {
    63  		return nil, err
    64  	}
    65  
    66  	return ps, err
    67  }
    68  
    69  // Optional parameters for the method 'UpdateComplianceInquiry'
    70  type UpdateComplianceInquiryParams struct {
    71  	// The unique SID identifier of the Primary Customer Profile that should be used as a parent. Only necessary when creating a secondary Customer Profile.
    72  	PrimaryProfileSid *string `json:"PrimaryProfileSid,omitempty"`
    73  }
    74  
    75  func (params *UpdateComplianceInquiryParams) SetPrimaryProfileSid(PrimaryProfileSid string) *UpdateComplianceInquiryParams {
    76  	params.PrimaryProfileSid = &PrimaryProfileSid
    77  	return params
    78  }
    79  
    80  // Resume a specific Compliance Inquiry that has expired, or re-open a rejected Compliance Inquiry for editing.
    81  func (c *ApiService) UpdateComplianceInquiry(CustomerId string, params *UpdateComplianceInquiryParams) (*TrusthubV1ComplianceInquiry, error) {
    82  	path := "/v1/ComplianceInquiries/Customers/{CustomerId}/Initialize"
    83  	path = strings.Replace(path, "{"+"CustomerId"+"}", CustomerId, -1)
    84  
    85  	data := url.Values{}
    86  	headers := make(map[string]interface{})
    87  
    88  	if params != nil && params.PrimaryProfileSid != nil {
    89  		data.Set("PrimaryProfileSid", *params.PrimaryProfileSid)
    90  	}
    91  
    92  	resp, err := c.requestHandler.Post(c.baseURL+path, data, headers)
    93  	if err != nil {
    94  		return nil, err
    95  	}
    96  
    97  	defer resp.Body.Close()
    98  
    99  	ps := &TrusthubV1ComplianceInquiry{}
   100  	if err := json.NewDecoder(resp.Body).Decode(ps); err != nil {
   101  		return nil, err
   102  	}
   103  
   104  	return ps, err
   105  }