equal
deleted
inserted
replaced
33 Limit *LimitParams |
33 Limit *LimitParams |
34 } |
34 } |
35 |
35 |
36 // UpdateAccountParams contains option fields for the UpdateAccount command |
36 // UpdateAccountParams contains option fields for the UpdateAccount command |
37 type UpdateAccountParams struct { |
37 type UpdateAccountParams struct { |
38 DisplayName *string |
38 DisplayName *string |
39 Note *string |
39 Note *string |
40 AvatarImagePath *string |
40 AvatarImagePath *string |
41 HeaderImagePath *string |
41 HeaderImagePath *string |
42 Locked *bool |
42 Locked *bool |
43 Bot *bool |
43 Bot *bool |
44 //FieldsAttributes *[]Field |
44 FieldsAttributes *[]Field |
45 //Source *SourceParams |
45 Source *SourceParams |
46 } |
46 } |
47 |
47 |
48 // updateRelationship returns a Relationship entity |
48 // updateRelationship returns a Relationship entity |
49 // The operation 'op' can be "follow", "unfollow", "block", "unblock", |
49 // The operation 'op' can be "follow", "unfollow", "block", "unblock", |
50 // "mute", "unmute". |
50 // "mute", "unmute". |
445 params["bot"] = "true" |
445 params["bot"] = "true" |
446 } else { |
446 } else { |
447 params["bot"] = "false" |
447 params["bot"] = "false" |
448 } |
448 } |
449 } |
449 } |
|
450 if cmdParams.FieldsAttributes != nil { |
|
451 if len(*cmdParams.FieldsAttributes) > 4 { |
|
452 return nil, errors.New("too many fields (max=4)") |
|
453 } |
|
454 for i, attr := range *cmdParams.FieldsAttributes { |
|
455 qName := fmt.Sprintf("fields_attributes[%d][name]", i) |
|
456 qValue := fmt.Sprintf("fields_attributes[%d][value]", i) |
|
457 params[qName] = attr.Name |
|
458 params[qValue] = attr.Value |
|
459 } |
|
460 } |
|
461 if cmdParams.Source != nil { |
|
462 sourceJSON, err := json.Marshal(*cmdParams.Source) |
|
463 if err != nil { |
|
464 return nil, errors.Wrap(err, "could not encode source data") |
|
465 } |
|
466 params["source"] = string(sourceJSON) |
|
467 } |
450 |
468 |
451 var err error |
469 var err error |
452 var avatar, headerImage []byte |
470 var avatar, headerImage []byte |
453 |
471 |
454 avatar, err = readFile(cmdParams.AvatarImagePath) |
472 avatar, err = readFile(cmdParams.AvatarImagePath) |