Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Phonum 1568 #83

Open
wants to merge 22 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
138 changes: 138 additions & 0 deletions compliance_applications.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,138 @@
package plivo

import "time"

type ComplianceApplicationService struct {
client *Client
}

type SubmitComplianceApplicationResponse struct {
APIID string `json:"api_id"`
CreatedAt time.Time `json:"created_at"`
ComplianceApplicationID string `json:"compliance_application_id"`
Alias string `json:"alias"`
Status string `json:"status"`
EndUserType string `json:"end_user_type"`
CountryIso2 string `json:"country_iso2"`
NumberType string `json:"number_type"`
EndUserID string `json:"end_user_id"`
ComplianceRequirementID string `json:"compliance_requirement_id"`
Documents []struct {
DocumentID string `json:"document_id"`
Name string `json:"name"`
} `json:"documents"`
}

type UpdateComplianceApplicationParams struct {
ComplianceApplicationId string `json:"compliance_application_id"`
DocumentIds []string `json:"document_ids"`
}

type CreateComplianceApplicationParams struct {
ComplianceRequirementId string `json:"compliance_requirement_id,omitempty" url:"compliance_requirement_id,omitempty"`
EndUserId string `json:"end_user_id,omitempty" url:"end_user_id,omitempty"`
DocumentIds []string `json:"document_ids,omitempty" url:"document_ids, omitempty"`
Alias string `json:"alias,omitempty" url:"alias, omitempty"`
EndUserType string `json:"end_user_type,omitempty" url:"end_user_type, omitempty"`
CountryIso2 string `json:"country_iso2,omitempty" url:"country_iso2, omitempty"`
NumberType string `json:"number_type,omitempty" url:"number_type, omitempty"`
}

type ComplianceApplicationResponse struct {
APIID string `json:"api_id"`
CreatedAt time.Time `json:"created_at"`
ComplianceApplicationID string `json:"compliance_application_id"`
Alias string `json:"alias"`
Status string `json:"status"`
EndUserType string `json:"end_user_type"`
CountryIso2 string `json:"country_iso2"`
NumberType string `json:"number_type"`
EndUserID string `json:"end_user_id"`
ComplianceRequirementID string `json:"compliance_requirement_id"`
Documents []struct {
DocumentID string `json:"document_id"`
Name string `json:"name"`
} `json:"documents"`
}

type ListComplianceApplicationResponse struct {
APIID string `json:"api_id"`
Meta struct {
Limit int `json:"limit"`
Next string `json:"next"`
Offset int `json:"offset"`
Previous interface{} `json:"previous"`
TotalCount int `json:"total_count"`
} `json:"meta"`
Objects []struct {
CreatedAt time.Time `json:"created_at"`
ComplianceApplicationID string `json:"compliance_application_id"`
Alias string `json:"alias"`
Status string `json:"status"`
EndUserType string `json:"end_user_type"`
CountryIso2 string `json:"country_iso2"`
NumberType string `json:"number_type"`
EndUserID string `json:"end_user_id"`
ComplianceRequirementID string `json:"compliance_requirement_id"`
Documents []struct {
DocumentID string `json:"document_id"`
Name string `json:"name"`
} `json:"documents"`
} `json:"objects"`
}

func (service *ComplianceApplicationService) Get(complianceDocumentId string) (response *ComplianceApplicationResponse, err error) {
req, err := service.client.NewRequest("GET", nil, "ComplianceDocument/%s/", complianceDocumentId)
response = &ComplianceApplicationResponse{}
err = service.client.ExecuteRequest(req, response)
return
}

func (service *ComplianceApplicationService) List(params EndUserListParams) (response *ListComplianceApplicationResponse, err error) {
request, err := service.client.NewRequest("GET", params, "ComplianceApplication/")
if err != nil {
return
}
response = &ListComplianceApplicationResponse{}
err = service.client.ExecuteRequest(request, response)
return
}

func (service *ComplianceApplicationService) Create(params CreateComplianceApplicationParams) (response *ComplianceApplicationResponse, err error) {
request, err := service.client.NewRequest("POST", params, "ComplianceApplication/")
if err != nil {
return
}
response = &ComplianceApplicationResponse{}
err = service.client.ExecuteRequest(request, response)
return
}

func (service *ComplianceApplicationService) Update(params UpdateComplianceApplicationParams) (response *ComplianceApplicationResponse, err error) {
request, err := service.client.NewRequest("POST", params, "ComplianceApplication/%s/", params.ComplianceApplicationId)
if err != nil {
return
}
response = &ComplianceApplicationResponse{}
err = service.client.ExecuteRequest(request, response)
return
}

func (service *ComplianceApplicationService) Delete(complianceApplicationId string) (err error) {
req, err := service.client.NewRequest("DELETE", nil, "ComplianceApplication/%s/", complianceApplicationId)
if err != nil {
return
}
err = service.client.ExecuteRequest(req, nil)
return
}

func (service *ComplianceApplicationService) Submit(complianceApplicationId string) (response *SubmitComplianceApplicationResponse, err error) {
req, err := service.client.NewRequest("POST", nil, "ComplianceApplication/%s/Submit/", complianceApplicationId)
if err != nil {
return
}
response = &SubmitComplianceApplicationResponse{}
err = service.client.ExecuteRequest(req, response)
return
}
76 changes: 76 additions & 0 deletions compliance_document_types.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
package plivo

import "time"

type ComplianceDocumentTypeService struct {
client *Client
}

type GetComplianceDocumentTypeResponse struct {
APIID string `json:"api_id"`
Meta struct {
Limit int `json:"limit"`
Next interface{} `json:"next"`
Offset int `json:"offset"`
Previous interface{} `json:"previous"`
TotalCount int `json:"total_count"`
} `json:"meta"`
Objects []struct {
CreatedAt time.Time `json:"created_at"`
DocumentTypeID string `json:"document_type_id"`
DocumentName string `json:"document_name"`
Description string `json:"description"`
ProofRequired string `json:"proof_required"`
Information []struct {
FieldName string `json:"field_name"`
FieldType string `json:"field_type"`
FriendlyName string `json:"friendly_name"`
HelpText string `json:"help_text,omitempty"`
MaxLength int `json:"max_length,omitempty"`
MinLength int `json:"min_length,omitempty"`
Format string `json:"format,omitempty"`
} `json:"information"`
} `json:"objects"`
}

type ListComplianceDocumentTypeResponse struct {
APIID string `json:"api_id"`
Meta struct {
Limit int `json:"limit"`
Next interface{} `json:"next"`
Offset int `json:"offset"`
Previous interface{} `json:"previous"`
TotalCount int `json:"total_count"`
} `json:"meta"`
Objects []struct {
CreatedAt time.Time `json:"created_at"`
Description string `json:"description"`
DocumentName string `json:"document_name"`
DocumentTypeID string `json:"document_type_id"`
Information []struct {
FieldName string `json:"field_name"`
FieldType string `json:"field_type"`
FriendlyName string `json:"friendly_name"`
MaxLength int `json:"max_length,omitempty"`
MinLength int `json:"min_length,omitempty"`
} `json:"information"`
ProofRequired interface{} `json:"proof_required"`
} `json:"objects"`
}

func (service *ComplianceDocumentTypeService) Get(docId string) (response *GetComplianceDocumentTypeResponse, err error) {
req, err := service.client.NewRequest("GET", nil, "ComplianceDocumentType/%s/", docId)
response = &GetComplianceDocumentTypeResponse{}
err = service.client.ExecuteRequest(req, response)
return
}

func (service *ComplianceDocumentTypeService) List(params EndUserListParams) (response *ListComplianceDocumentTypeResponse, err error) {
request, err := service.client.NewRequest("GET", params, "ComplianceDocumentType/")
if err != nil {
return
}
response = &ListComplianceDocumentTypeResponse{}
err = service.client.ExecuteRequest(request, response)
return
}
Loading